home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / cslib16b / lib / bc31 / csd.lib next >
Encoding:
Text File  |  1995-03-02  |  376.5 KB  |  12,480 lines

  1.  := 0;
  2.       end;
  3.     end;
  4.   end;
  5.   WaitToGo;
  6. end; { UserLineStylePlay }
  7.  
  8.  
  9. procedure SayGoodbye;
  10. { Say goodbye and then exit the program }
  11. var
  12.   ViewInfo : ViewPortType;
  13. begin
  14.   MainWindow('');
  15.   GetViewSettings(ViewInfo);
  16.   SetTextStyle(TriplexFont, HorizDir, 4);
  17.   SetTextJustify(CenterText, CenterText);
  18.   with ViewInfo do
  19.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  20.   StatusLine('Press any key to quit...');
  21.   repeat until KeyPressed;
  22. end; { SayGoodbye }
  23.  
  24.  
  25. PROCEDURE SelectMode;
  26. VAR
  27.     choice1,choice2     : CHAR;
  28.    xsize,ysize            : WORD;
  29. BEGIN
  30.     (* Let's select a mode *)
  31.     ClrScr;
  32.     WriteLn('VESADEMO:');
  33.     WriteLn('1. 256 colors');
  34.     WriteLn('2. 32768 colors');
  35.     WriteLn('3. 65536 colors');
  36.     WriteLn('4. 16777216 colors');
  37.     WriteLn('Q uit');
  38.     WriteLn;
  39.     Write('Your choice: ');
  40.     REPEAT
  41.         ReadLn(choice1);
  42.       IF choice1 <> '1' THEN BEGIN
  43.           WriteLn('Sorry !');
  44.          WriteLn('This demo wasn''t written for more as 256 colors !');
  45.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  46.          WriteLn('Switching to 256 colors.');
  47.          choice1 := '1';
  48.       END;
  49.     UNTIL choice1 IN ['1'..'4','q'];
  50.     IF choice1 = 'q' THEN Halt;
  51.  
  52.     WriteLn;
  53.     WriteLn;
  54.     WriteLn('a. 320x200');
  55.     WriteLn('b. 640x480');
  56.     WriteLn('c. 800x600');
  57.     WriteLn('d. 1024x768');
  58.     WriteLn('e. 1280x1024');
  59.     WriteLn('Q uit');
  60.     WriteLn;
  61.     Write('Your choice: ');
  62.     REPEAT
  63.         ReadLn(choice2);
  64.     UNTIL choice2 IN ['a'..'e','q'];
  65.     IF choice2 = 'q' THEN Halt;
  66.  
  67.     CASE choice2 OF
  68.         'a' : BEGIN
  69.             xsize := 320;
  70.             ysize := 200;
  71.         END;
  72.         'b' : BEGIN
  73.             xsize := 640;
  74.             ysize := 480;
  75.         END;
  76.         'c' : BEGIN
  77.             xsize := 800;
  78.             ysize := 600;
  79.         END;
  80.         'd' : BEGIN
  81.             xsize := 1024;
  82.             ysize := 768;
  83.         END;
  84.         'e' : BEGIN
  85.             xsize := 1280;
  86.             ysize := 1024;
  87.         END;
  88.     END;
  89.     CASE choice1 OF
  90.         '1' : mode := FindVesaMode(xsize,ysize,8);
  91.         '2' : mode := FindVesaMode(xsize,ysize,15);
  92.         '3' : mode := FindVesaMode(xsize,ysize,16);
  93.         '4' : mode := FindVesaMode(xsize,ysize,24);
  94.     END;
  95.     IF mode = 0 THEN BEGIN
  96.         WriteLn('No such mode could be found !');
  97.         WriteLn('Switching to to 320x200.');
  98.         ReadKey;
  99.         mode := V320x200x256;
  100.     END;
  101. END;
  102.  
  103. begin { program body }
  104.   SelectMode;
  105.   Initialize;
  106.   ReportStatus;
  107.  
  108. {  AspectRatioPlay; }
  109.   FillEllipsePlay;
  110.   SectorPlay;
  111.   WriteModePlay;
  112.  
  113.   ColorPlay;
  114.   { PalettePlay only intended to work on these drivers: }
  115.   if (GraphDriver = EGA) or
  116.       (GraphDriver = EGA64) or
  117.       (GraphDriver = VGA) then
  118.      PalettePlay;
  119.   PutPixelPlay;
  120. {  PutImagePlay; }
  121.   RandBarPlay;
  122.   BarPlay;
  123.   Bar3DPlay;
  124.   ArcPlay;
  125.   CirclePlay;
  126.   PiePlay;
  127.   LineToPlay;
  128.   LineRelPlay;
  129. {  LineStylePlay; }
  130. {  UserLineStylePlay; }
  131.   TextDump;
  132.   TextPlay;
  133.   CrtModePlay;
  134.   FillStylePlay;
  135.   FillPatternPlay;
  136.   PolyPlay;
  137.   SayGoodbye;
  138. {  CloseGraph; }
  139.   CloseVesa;
  140. end.
  141. ***************************************************
  142.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  143.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  144. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  145. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  146. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  147. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  148.     Color := RandColor;
  149.     SetColor(Color);
  150.     SetFillStyle(Random(CloseDotFill)+1, Color);
  151.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  152.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  153.   until KeyPressed;
  154.   WaitToGo;
  155. end; { RandBarPlay }
  156.  
  157. procedure ArcPlay;
  158. { Draw random arcs on the screen }
  159. var
  160.   MaxRadius : word;
  161.   EndAngle : word;
  162.   ArcInfo : ArcCoordsType;
  163. begin
  164.   MainWindow('Arc / GetArcCoords demonstration');
  165.   StatusLine('Esc aborts or press a key');
  166.   MaxRadius := MaxY div 10;
  167.   repeat
  168.     SetColor(RandColor);
  169.     EndAngle := Random(360);
  170.     SetLineStyle(SolidLn, 0, NormWidth);
  171.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  172.     GetArcCoords(ArcInfo);
  173.     with ArcInfo do
  174.     begin
  175.       Line(X, Y, XStart, YStart);
  176.       Line(X, Y, Xend, Yend);
  177.     end;
  178.   until KeyPressed;
  179.   WaitToGo;
  180. end; { ArcPlay }
  181.  
  182. procedure PutPixelPlay;
  183. { Demonstrate the PutPixel and GetPixel commands }
  184. const
  185.   Seed   = 1962; { A seed for the random number generator }
  186.   NumPts = 2000; { The number of pixels plotted }
  187.   Esc    = #27;
  188. var
  189.   I : word;
  190.   X, Y, Color : word;
  191.   XMax, YMax  : integer;
  192.   ViewInfo    : ViewPortType;
  193. begin
  194.   MainWindow('PutPixel / GetPixel demonstration');
  195.   StatusLine('Esc aborts or press a key...');
  196.  
  197.   GetViewSettings(ViewInfo);
  198.   with ViewInfo do
  199.   begin
  200.     XMax := (x2-x1-1);
  201.     YMax := (y2-y1-1);
  202.   end;
  203.  
  204.   while not KeyPressed do
  205.   begin
  206.     { Plot random pixels }
  207.     RandSeed := Seed;
  208.     I := 0;
  209.     while (not KeyPressed) and (I < NumPts) do
  210.     begin
  211.       Inc(I);
  212.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  213.     end;
  214.  
  215.     { Erase pixels }
  216.     RandSeed := Seed;
  217.     I := 0;
  218.     while (not KeyPressed) and (I < NumPts) do
  219.     begin
  220.       Inc(I);
  221.       X := Random(XMax)+1;
  222.       Y := Random(YMax)+1;
  223.       Color := GetPixel(X, Y);
  224.         if Color = RandColor then
  225.           PutPixel(X, Y, 0);
  226.      end;
  227.   end;
  228.   WaitToGo;
  229. end; { PutPixelPlay }
  230.  
  231. procedure PutImagePlay;
  232. { Demonstrate the GetImage and PutImage commands }
  233.  
  234. const
  235.   r  = 20;
  236.   StartX = 100;
  237.   StartY = 50;
  238.  
  239. var
  240.   CurPort : ViewPortType;
  241.  
  242. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  243. var
  244.   Step : integer;
  245. begin
  246.   Step := Random(2*r);
  247.   if Odd(Step) then
  248.     Step := -Step;
  249.   X := X + Step;
  250.   Step := Random(r);
  251.   if Odd(Step) then
  252.     Step := -Step;
  253.   Y := Y + Step;
  254.  
  255.   { Make saucer bounce off viewport walls }
  256.   with CurPort do
  257.   begin
  258.     if (x1 + X + Width - 1 > x2) then
  259.       X := x2-x1 - Width + 1
  260.     else
  261.       if (X < 0) then
  262.         X := 0;
  263.     if (y1 + Y + Height - 1 > y2) then
  264.       Y := y2-y1 - Height + 1
  265.     else
  266.       if (Y < 0) then
  267.         Y := 0;
  268.   end;
  269. end; { MoveSaucer }
  270.  
  271. var
  272.   Pausetime : word;
  273.   Saucer    : pointer;
  274.   X, Y      : integer;
  275.   ulx, uly  : word;
  276.   lrx, lry  : word;
  277.   Size      : word;
  278.   I         : word;
  279. begin
  280.   ClearDevice;
  281.   FullPort;
  282.  
  283.   { PaintScreen }
  284.   ClearDevice;
  285.   MainWindow('GetImage / PutImage Demonstration');
  286.   StatusLine('Esc aborts or press a key...');
  287.   GetViewSettings(CurPort);
  288.  
  289.   { DrawSaucer }
  290.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  291.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  292.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  293.   Circle(StartX+10, StartY-12, 2);
  294.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  295.   Circle(StartX-10, StartY-12, 2);
  296.   SetFillStyle(SolidFill, MaxColor);
  297.   FloodFill(StartX+1, StartY+4, GetColor);
  298.  
  299.   { ReadSaucerImage }
  300.   ulx := StartX-(r+1);
  301.   uly := StartY-14;
  302.   lrx := StartX+(r+1);
  303.   lry := StartY+(r div 3)+3;
  304.  
  305.   Size := ImageSize(ulx, uly, lrx, lry);
  306.   GetMem(Saucer, Size);
  307.   GetImage(ulx, uly, lrx, lry, Saucer^);
  308. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  309.  
  310.   { Plot some "stars" }
  311.   for I := 1 to 1000 do
  312.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  313.   X := MaxX div 2;
  314.   Y := MaxY div 2;
  315.   PauseTime := 70;
  316.  
  317.   { Move the saucer around }
  318.   repeat
  319. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  320.      Delay(PauseTime);
  321. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  322.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  323.   until KeyPressed;
  324.   FreeMem(Saucer, size);
  325.   WaitToGo;
  326. end; { PutImagePlay }
  327.  
  328. procedure PolyPlay;
  329. { Draw random polygons with random fill styles on the screen }
  330. const
  331.   MaxPts = 5;
  332. type
  333.   PolygonType = array[1..MaxPts] of PointType;
  334. var
  335.   Poly : PolygonType;
  336.   I, Color : word;
  337. begin
  338.   MainWindow('FillPoly demonstration');
  339.   StatusLine('Esc aborts or press a key...');
  340.   repeat
  341.     Color := RandColor;
  342.     SetFillStyle(Random(11)+1, Color);
  343.     SetColor(Color);
  344.     for I := 1 to MaxPts do
  345.       with Poly[I] do
  346.       begin
  347.         X := Random(MaxX);
  348.         Y := Random(MaxY);
  349.       end;
  350.     FillPoly(MaxPts, Poly);
  351.   until KeyPressed;
  352.   WaitToGo;
  353. end; { PolyPlay }
  354.  
  355. procedure FillStylePlay;
  356. { Display all of the predefined fill styles available }
  357. var
  358.   Style    : word;
  359.   Width    : word;
  360.   Height   : word;
  361.   X, Y     : word;
  362.   I, J     : word;
  363.   ViewInfo : ViewPortType;
  364.  
  365. procedure DrawBox(X, Y : word);
  366. begin
  367.   SetFillStyle(Style, MaxColor);
  368.   with ViewInfo do
  369.     Bar(X, Y, X+Width, Y+Height);
  370.   Rectangle(X, Y, X+Width, Y+Height);
  371.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  372.   Inc(Style);
  373. end; { DrawBox }
  374.  
  375. begin
  376.   MainWindow('Pre-defined fill styles');
  377.   GetViewSettings(ViewInfo);
  378.   with ViewInfo do
  379.   begin
  380.     Width := 2 * ((x2+1) div 13);
  381.     Height := 2 * ((y2-10) div 10);
  382.   end;
  383.   X := Width div 2;
  384.   Y := Height div 2;
  385.   Style := 0;
  386.   for J := 1 to 3 do
  387.   begin
  388.     for I := 1 to 4 do
  389.     begin
  390.       DrawBox(X, Y);
  391.       Inc(X, (Width div 2) * 3);
  392.     end;
  393.     X := Width div 2;
  394.     Inc(Y, (Height div 2) * 3);
  395.   end;
  396.   SetTextJustify(LeftText, TopText);
  397.   WaitToGo;
  398. end; { FillStylePlay }
  399.  
  400. procedure FillPatternPlay;
  401. { Display some user defined fill patterns }
  402. const
  403.   Patterns : array[0..11] of FillPatternType = (
  404.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  405.             OldColor which has a path of pixels of OldColor or NewColor
  406.             with sides touching back to the seed point, (XSeed, YSeed).
  407.             Therefore, only pixels of OldColor are modified and no other
  408.             information is changed.
  409.  
  410.             SEE ALSO
  411.  
  412.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  413.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  414.             SETVIEW
  415.  
  416.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  417.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  418.             IF WHICHVGA = 0 THEN STOP
  419.             DUMMY=RES640
  420.             SETVIEW 100, 100, 539, 379
  421.             FILLVIEW 10
  422.             WHILE INKEY$ = ""
  423.             WEND
  424.             VIDEOMODESET VMODE
  425.             END
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.                                                                          63
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.           FONTGETINFO
  450.  
  451.             PROTOTYPE
  452.  
  453.             SUB FONTGETINFO (Width%, Height%)
  454.  
  455.             INPUT
  456.  
  457.             no input parameters
  458.     WEND
  459.             MOUSEEXIT
  460.             VIDEOMODESET VMODE
  461.             END
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.                                                                          86
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.           MOUSECURSORDEFAULT
  510.  
  511.             PROTOTYPE
  512.  
  513.             SUB MOUSECURSORDEFAULT ()
  514.  
  515.             INPUT
  516.  
  517.             no input parameters
  518.  
  519.             OUTPUT
  520.  
  521.             no value returned
  522.  
  523.             USAGE
  524.  
  525.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  526.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  527. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  528. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  529. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  530. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  531. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  532. $╤
  533. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  534. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  535. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  536. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  537. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  538. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  539. ░£▒
  540. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  541. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  542.       end;
  543.     end;
  544.   end;
  545.   WaitToGo;
  546. end; { UserLineStylePlay }
  547.  
  548.  
  549. procedure SayGoodbye;
  550. { Say goodbye and then exit the program }
  551. var
  552.   ViewInfo : ViewPortType;
  553. begin
  554.   MainWindow('');
  555.   GetViewSettings(ViewInfo);
  556.   SetTextStyle(TriplexFont, HorizDir, 4);
  557.   SetTextJustify(CenterText, CenterText);
  558.   with ViewInfo do
  559.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  560.   StatusLine('Press any key to quit...');
  561.   repeat until KeyPressed;
  562. end; { SayGoodbye }
  563.  
  564.  
  565. PROCEDURE SelectMode;
  566. VAR
  567.     choice1,choice2     : CHAR;
  568.    xsize,ysize            : WORD;
  569. BEGIN
  570.     (* Let's select a mode *)
  571.     ClrScr;
  572.     WriteLn('VESADEMO:');
  573.     WriteLn('1. 256 colors');
  574.     WriteLn('2. 32768 colors');
  575.     WriteLn('3. 65536 colors');
  576.     WriteLn('4. 16777216 colors');
  577.     WriteLn('Q uit');
  578.     WriteLn;
  579.     Write('Your choice: ');
  580.     REPEAT
  581.         ReadLn(choice1);
  582.       IF choice1 <> '1' THEN BEGIN
  583.           WriteLn('Sorry !');
  584.          WriteLn('This demo wasn''t written for more as 256 colors !');
  585.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  586.          WriteLn('Switching to 256 colors.');
  587.          choice1 := '1';
  588.       END;
  589.     UNTIL choice1 IN ['1'..'4','q'];
  590.     IF choice1 = 'q' THEN Halt;
  591.  
  592.     WriteLn;
  593.     WriteLn;
  594.     WriteLn('a. 320x200');
  595.     WriteLn('b. 640x480');
  596.     WriteLn('c. 800x600');
  597.     WriteLn('d. 1024x768');
  598.     WriteLn('e. 1280x1024');
  599.     WriteLn('Q uit');
  600.     WriteLn;
  601.     Write('Your choice: ');
  602.     REPEAT
  603.         ReadLn(choice2);
  604.     UNTIL choice2 IN ['a'..'e','q'];
  605.     IF choice2 = 'q' THEN Halt;
  606.  
  607.     CASE choice2 OF
  608.         'a' : BEGIN
  609.             xsize := 320;
  610.             ysize := 200;
  611.         END;
  612.         'b' : BEGIN
  613.             xsize := 640;
  614.             ysize := 480;
  615.         END;
  616.         'c' : BEGIN
  617.             xsize := 800;
  618.             ysize := 600;
  619.         END;
  620.         'd' : BEGIN
  621.             xsize := 1024;
  622.             ysize := 768;
  623.         END;
  624.         'e' : BEGIN
  625.             xsize := 1280;
  626.             ysize := 1024;
  627.         END;
  628.     END;
  629.     CASE choice1 OF
  630.         '1' : mode := FindVesaMode(xsize,ysize,8);
  631.         '2' : mode := FindVesaMode(xsize,ysize,15);
  632.         '3' : mode := FindVesaMode(xsize,ysize,16);
  633.         '4' : mode := FindVesaMode(xsize,ysize,24);
  634.     END;
  635.     IF mode = 0 THEN BEGIN
  636.         WriteLn('No such mode could be found !');
  637.         WriteLn('Switching to to 320x200.');
  638.         ReadKey;
  639.         mode := V320x200x256;
  640.     END;
  641. END;
  642.  
  643. begin { program body }
  644.   SelectMode;
  645.   Initialize;
  646.   ReportStatus;
  647.  
  648. {  AspectRatioPlay; }
  649.   FillEllipsePlay;
  650.   SectorPlay;
  651.   WriteModePlay;
  652.  
  653.   ColorPlay;
  654.   { PalettePlay only intended to work on these drivers: }
  655.   if (GraphDriver = EGA) or
  656.       (GraphDriver = EGA64) or
  657.       (GraphDriver = VGA) then
  658.      PalettePlay;
  659.   PutPixelPlay;
  660. {  PutImagePlay; }
  661.   RandBarPlay;
  662.   BarPlay;
  663.   Bar3DPlay;
  664.   ArcPlay;
  665.   CirclePlay;
  666.   PiePlay;
  667.   LineToPlay;
  668.   LineRelPlay;
  669. {  LineStylePlay; }
  670. {  UserLineStylePlay; }
  671.   TextDump;
  672.   TextPlay;
  673.   CrtModePlay;
  674.   FillStylePlay;
  675.   FillPatternPlay;
  676.   PolyPlay;
  677.   SayGoodbye;
  678. {  CloseGraph; }
  679.   CloseVesa;
  680. end.
  681. ***************************************************
  682.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  683.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  684. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  685. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  686. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  687. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  688.     Color := RandColor;
  689.     SetColor(Color);
  690.     SetFillStyle(Random(CloseDotFill)+1, Color);
  691.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  692.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  693.   until KeyPressed;
  694.   WaitToGo;
  695. end; { RandBarPlay }
  696.  
  697. procedure ArcPlay;
  698. { Draw random arcs on the screen }
  699. var
  700.   MaxRadius : word;
  701.   EndAngle : word;
  702.   ArcInfo : ArcCoordsType;
  703. begin
  704.   MainWindow('Arc / GetArcCoords demonstration');
  705.   StatusLine('Esc aborts or press a key');
  706.   MaxRadius := MaxY div 10;
  707.   repeat
  708.     SetColor(RandColor);
  709.     EndAngle := Random(360);
  710.     SetLineStyle(SolidLn, 0, NormWidth);
  711.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  712.     GetArcCoords(ArcInfo);
  713.     with ArcInfo do
  714.     begin
  715.       Line(X, Y, XStart, YStart);
  716.       Line(X, Y, Xend, Yend);
  717.     end;
  718.   until KeyPressed;
  719.   WaitToGo;
  720. end; { ArcPlay }
  721.  
  722. procedure PutPixelPlay;
  723. { Demonstrate the PutPixel and GetPixel commands }
  724. const
  725.   Seed   = 1962; { A seed for the random number generator }
  726.   NumPts = 2000; { The number of pixels plotted }
  727.   Esc    = #27;
  728. var
  729.   I : word;
  730.   X, Y, Color : word;
  731.   XMax, YMax  : integer;
  732.   ViewInfo    : ViewPortType;
  733. begin
  734.   MainWindow('PutPixel / GetPixel demonstration');
  735.   StatusLine('Esc aborts or press a key...');
  736.  
  737.   GetViewSettings(ViewInfo);
  738.   with ViewInfo do
  739.   begin
  740.     XMax := (x2-x1-1);
  741.     YMax := (y2-y1-1);
  742.   end;
  743.  
  744.   while not KeyPressed do
  745.   begin
  746.     { Plot random pixels }
  747.     RandSeed := Seed;
  748.     I := 0;
  749.     while (not KeyPressed) and (I < NumPts) do
  750.     begin
  751.       Inc(I);
  752.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  753.     end;
  754.  
  755.     { Erase pixels }
  756.     RandSeed := Seed;
  757.     I := 0;
  758.     while (not KeyPressed) and (I < NumPts) do
  759.     begin
  760.       Inc(I);
  761.       X := Random(XMax)+1;
  762.       Y := Random(YMax)+1;
  763.       Color := GetPixel(X, Y);
  764.         if Color = RandColor then
  765.           PutPixel(X, Y, 0);
  766.      end;
  767.   end;
  768.   WaitToGo;
  769. end; { PutPixelPlay }
  770.  
  771. procedure PutImagePlay;
  772. { Demonstrate the GetImage and PutImage commands }
  773.  
  774. const
  775.   r  = 20;
  776.   StartX = 100;
  777.   StartY = 50;
  778.  
  779. var
  780.   CurPort : ViewPortType;
  781.  
  782. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  783. var
  784.   Step : integer;
  785. begin
  786.   Step := Random(2*r);
  787.   if Odd(Step) then
  788.     Step := -Step;
  789.   X := X + Step;
  790.   Step := Random(r);
  791.   if Odd(Step) then
  792.     Step := -Step;
  793.   Y := Y + Step;
  794.  
  795.   { Make saucer bounce off viewport walls }
  796.   with CurPort do
  797.   begin
  798.     if (x1 + X + Width - 1 > x2) then
  799.       X := x2-x1 - Width + 1
  800.     else
  801.       if (X < 0) then
  802.         X := 0;
  803.     if (y1 + Y + Height - 1 > y2) then
  804.       Y := y2-y1 - Height + 1
  805.     else
  806.       if (Y < 0) then
  807.         Y := 0;
  808.   end;
  809. end; { MoveSaucer }
  810.  
  811. var
  812.   Pausetime : word;
  813.   Saucer    : pointer;
  814.   X, Y      : integer;
  815.   ulx, uly  : word;
  816.   lrx, lry  : word;
  817.   Size      : word;
  818.   I         : word;
  819. begin
  820.   ClearDevice;
  821.   FullPort;
  822.  
  823.   { PaintScreen }
  824.   ClearDevice;
  825.   MainWindow('GetImage / PutImage Demonstration');
  826.   StatusLine('Esc aborts or press a key...');
  827.   GetViewSettings(CurPort);
  828.  
  829.   { DrawSaucer }
  830.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  831.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  832.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  833.   Circle(StartX+10, StartY-12, 2);
  834.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  835.   Circle(StartX-10, StartY-12, 2);
  836.   SetFillStyle(SolidFill, MaxColor);
  837.   FloodFill(StartX+1, StartY+4, GetColor);
  838.  
  839.   { ReadSaucerImage }
  840.   ulx := StartX-(r+1);
  841.   uly := StartY-14;
  842.   lrx := StartX+(r+1);
  843.   lry := StartY+(r div 3)+3;
  844.  
  845.   Size := ImageSize(ulx, uly, lrx, lry);
  846.   GetMem(Saucer, Size);
  847.   GetImage(ulx, uly, lrx, lry, Saucer^);
  848. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  849.  
  850.   { Plot some "stars" }
  851.   for I := 1 to 1000 do
  852.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  853.   X := MaxX div 2;
  854.   Y := MaxY div 2;
  855.   PauseTime := 70;
  856.  
  857.   { Move the saucer around }
  858.   repeat
  859. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  860.      Delay(PauseTime);
  861. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  862.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  863.   until KeyPressed;
  864.   FreeMem(Saucer, size);
  865.   WaitToGo;
  866. end; { PutImagePlay }
  867.  
  868. procedure PolyPlay;
  869. { Draw random polygons with random fill styles on the screen }
  870. const
  871.   MaxPts = 5;
  872. type
  873.   PolygonType = array[1..MaxPts] of PointType;
  874. var
  875.   Poly : PolygonType;
  876.   I, Color : word;
  877. begin
  878.   MainWindow('FillPoly demonstration');
  879.   StatusLine('Esc aborts or press a key...');
  880.   repeat
  881.     Color := RandColor;
  882.     SetFillStyle(Random(11)+1, Color);
  883.     SetColor(Color);
  884.     for I := 1 to MaxPts do
  885.       with Poly[I] do
  886.       begin
  887.         X := Random(MaxX);
  888.         Y := Random(MaxY);
  889.       end;
  890.     FillPoly(MaxPts, Poly);
  891.   until KeyPressed;
  892.   WaitToGo;
  893. end; { PolyPlay }
  894.  
  895. procedure FillStylePlay;
  896. { Display all of the predefined fill styles available }
  897. var
  898.   Style    : word;
  899.   Width    : word;
  900.   Height   : word;
  901.   X, Y     : word;
  902.   I, J     : word;
  903.   ViewInfo : ViewPortType;
  904.  
  905. procedure DrawBox(X, Y : word);
  906. begin
  907.   SetFillStyle(Style, MaxColor);
  908.   with ViewInfo do
  909.     Bar(X, Y, X+Width, Y+Height);
  910.   Rectangle(X, Y, X+Width, Y+Height);
  911.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  912.   Inc(Style);
  913. end; { DrawBox }
  914.  
  915. begin
  916.   MainWindow('Pre-defined fill styles');
  917.   GetViewSettings(ViewInfo);
  918.   with ViewInfo do
  919.   begin
  920.     Width := 2 * ((x2+1) div 13);
  921.     Height := 2 * ((y2-10) div 10);
  922.   end;
  923.   X := Width div 2;
  924.   Y := Height div 2;
  925.   Style := 0;
  926.   for J := 1 to 3 do
  927.   begin
  928.     for I := 1 to 4 do
  929.     begin
  930.       DrawBox(X, Y);
  931.       Inc(X, (Width div 2) * 3);
  932.     end;
  933.     X := Width div 2;
  934.     Inc(Y, (Height div 2) * 3);
  935.   end;
  936.   SetTextJustify(LeftText, TopText);
  937.   WaitToGo;
  938. end; { FillStylePlay }
  939.  
  940. procedure FillPatternPlay;
  941. { Display some user defined fill patterns }
  942. const
  943.   Patterns : array[0..11] of FillPatternType = (
  944.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  945.             OldColor which has a path of pixels of OldColor or NewColor
  946.             with sides touching back to the seed point, (XSeed, YSeed).
  947.             Therefore, only pixels of OldColor are modified and no other
  948.             information is changed.
  949.  
  950.             SEE ALSO
  951.  
  952.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  953.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  954.             SETVIEW
  955.  
  956.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  957.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  958.             IF WHICHVGA = 0 THEN STOP
  959.             DUMMY=RES640
  960.             SETVIEW 100, 100, 539, 379
  961.             FILLVIEW 10
  962.             WHILE INKEY$ = ""
  963.             WEND
  964.             VIDEOMODESET VMODE
  965.             END
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.                                                                          63
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.           FONTGETINFO
  990.  
  991.             PROTOTYPE
  992.  
  993.             SUB FONTGETINFO (Width%, Height%)
  994.  
  995.             INPUT
  996.  
  997.             no input parameters
  998.     WEND
  999.             MOUSEEXIT
  1000.             VIDEOMODESET VMODE
  1001.             END
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.                                                                          86
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.           MOUSECURSORDEFAULT
  1050.  
  1051.             PROTOTYPE
  1052.  
  1053.             SUB MOUSECURSORDEFAULT ()
  1054.  
  1055.             INPUT
  1056.  
  1057.             no input parameters
  1058.  
  1059.             OUTPUT
  1060.  
  1061.             no value returned
  1062.  
  1063.             USAGE
  1064.  
  1065.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1066.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  1067. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1068. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  1069. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1070. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1071. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1072. $╤
  1073. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  1074. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  1075. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1076. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1077. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  1078. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  1079. ░£▒
  1080. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  1081. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1082.       end;
  1083.     end;
  1084.   end;
  1085.   WaitToGo;
  1086. end; { UserLineStylePlay }
  1087.  
  1088.  
  1089. procedure SayGoodbye;
  1090. { Say goodbye and then exit the program }
  1091. var
  1092.   ViewInfo : ViewPortType;
  1093. begin
  1094.   MainWindow('');
  1095.   GetViewSettings(ViewInfo);
  1096.   SetTextStyle(TriplexFont, HorizDir, 4);
  1097.   SetTextJustify(CenterText, CenterText);
  1098.   with ViewInfo do
  1099.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1100.   StatusLine('Press any key to quit...');
  1101.   repeat until KeyPressed;
  1102. end; { SayGoodbye }
  1103.  
  1104.  
  1105. PROCEDURE SelectMode;
  1106. VAR
  1107.     choice1,choice2     : CHAR;
  1108.    xsize,ysize            : WORD;
  1109. BEGIN
  1110.     (* Let's select a mode *)
  1111.     ClrScr;
  1112.     WriteLn('VESADEMO:');
  1113.     WriteLn('1. 256 colors');
  1114.     WriteLn('2. 32768 colors');
  1115.     WriteLn('3. 65536 colors');
  1116.     WriteLn('4. 16777216 colors');
  1117.     WriteLn('Q uit');
  1118.     WriteLn;
  1119.     Write('Your choice: ');
  1120.     REPEAT
  1121.         ReadLn(choice1);
  1122.       IF choice1 <> '1' THEN BEGIN
  1123.           WriteLn('Sorry !');
  1124.          WriteLn('This demo wasn''t written for more as 256 colors !');
  1125.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  1126.          WriteLn('Switching to 256 colors.');
  1127.          choice1 := '1';
  1128.       END;
  1129.     UNTIL choice1 IN ['1'..'4','q'];
  1130.     IF choice1 = 'q' THEN Halt;
  1131.  
  1132.     WriteLn;
  1133.     WriteLn;
  1134.     WriteLn('a. 320x200');
  1135.     WriteLn('b. 640x480');
  1136.     WriteLn('c. 800x600');
  1137.     WriteLn('d. 1024x768');
  1138.     WriteLn('e. 1280x1024');
  1139.     WriteLn('Q uit');
  1140.     WriteLn;
  1141.     Write('Your choice: ');
  1142.     REPEAT
  1143.         ReadLn(choice2);
  1144.     UNTIL choice2 IN ['a'..'e','q'];
  1145.     IF choice2 = 'q' THEN Halt;
  1146.  
  1147.     CASE choice2 OF
  1148.         'a' : BEGIN
  1149.             xsize := 320;
  1150.             ysize := 200;
  1151.         END;
  1152.         'b' : BEGIN
  1153.             xsize := 640;
  1154.             ysize := 480;
  1155.         END;
  1156.         'c' : BEGIN
  1157.             xsize := 800;
  1158.             ysize := 600;
  1159.         END;
  1160.         'd' : BEGIN
  1161.             xsize := 1024;
  1162.             ysize := 768;
  1163.         END;
  1164.         'e' : BEGIN
  1165.             xsize := 1280;
  1166.             ysize := 1024;
  1167.         END;
  1168.     END;
  1169.     CASE choice1 OF
  1170.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1171.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1172.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1173.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1174.     END;
  1175.     IF mode = 0 THEN BEGIN
  1176.         WriteLn('No such mode could be found !');
  1177.         WriteLn('Switching to to 320x200.');
  1178.         ReadKey;
  1179.         mode := V320x200x256;
  1180.     END;
  1181. END;
  1182.  
  1183. begin { program body }
  1184.   SelectMode;
  1185.   Initialize;
  1186.   ReportStatus;
  1187.  
  1188. {  AspectRatioPlay; }
  1189.   FillEllipsePlay;
  1190.   SectorPlay;
  1191.   WriteModePlay;
  1192.  
  1193.   ColorPlay;
  1194.   { PalettePlay only intended to work on these drivers: }
  1195.   if (GraphDriver = EGA) or
  1196.       (GraphDriver = EGA64) or
  1197.       (GraphDriver = VGA) then
  1198.      PalettePlay;
  1199.   PutPixelPlay;
  1200. {  PutImagePlay; }
  1201.   RandBarPlay;
  1202.   BarPlay;
  1203.   Bar3DPlay;
  1204.   ArcPlay;
  1205.   CirclePlay;
  1206.   PiePlay;
  1207.   LineToPlay;
  1208.   LineRelPlay;
  1209. {  LineStylePlay; }
  1210. {  UserLineStylePlay; }
  1211.   TextDump;
  1212.   TextPlay;
  1213.   CrtModePlay;
  1214.   FillStylePlay;
  1215.   FillPatternPlay;
  1216.   PolyPlay;
  1217.   SayGoodbye;
  1218. {  CloseGraph; }
  1219.   CloseVesa;
  1220. end.
  1221. ***************************************************
  1222.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1223.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  1224. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  1225. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1226. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1227. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1228.     Color := RandColor;
  1229.     SetColor(Color);
  1230.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1231.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1232.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1233.   until KeyPressed;
  1234.   WaitToGo;
  1235. end; { RandBarPlay }
  1236.  
  1237. procedure ArcPlay;
  1238. { Draw random arcs on the screen }
  1239. var
  1240.   MaxRadius : word;
  1241.   EndAngle : word;
  1242.   ArcInfo : ArcCoordsType;
  1243. begin
  1244.   MainWindow('Arc / GetArcCoords demonstration');
  1245.   StatusLine('Esc aborts or press a key');
  1246.   MaxRadius := MaxY div 10;
  1247.   repeat
  1248.     SetColor(RandColor);
  1249.     EndAngle := Random(360);
  1250.     SetLineStyle(SolidLn, 0, NormWidth);
  1251.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1252.     GetArcCoords(ArcInfo);
  1253.     with ArcInfo do
  1254.     begin
  1255.       Line(X, Y, XStart, YStart);
  1256.       Line(X, Y, Xend, Yend);
  1257.     end;
  1258.   until KeyPressed;
  1259.   WaitToGo;
  1260. end; { ArcPlay }
  1261.  
  1262. procedure PutPixelPlay;
  1263. { Demonstrate the PutPixel and GetPixel commands }
  1264. const
  1265.   Seed   = 1962; { A seed for the random number generator }
  1266.   NumPts = 2000; { The number of pixels plotted }
  1267.   Esc    = #27;
  1268. var
  1269.   I : word;
  1270.   X, Y, Color : word;
  1271.   XMax, YMax  : integer;
  1272.   ViewInfo    : ViewPortType;
  1273. begin
  1274.   MainWindow('PutPixel / GetPixel demonstration');
  1275.   StatusLine('Esc aborts or press a key...');
  1276.  
  1277.   GetViewSettings(ViewInfo);
  1278.   with ViewInfo do
  1279.   begin
  1280.     XMax := (x2-x1-1);
  1281.     YMax := (y2-y1-1);
  1282.   end;
  1283.  
  1284.   while not KeyPressed do
  1285.   begin
  1286.     { Plot random pixels }
  1287.     RandSeed := Seed;
  1288.     I := 0;
  1289.     while (not KeyPressed) and (I < NumPts) do
  1290.     begin
  1291.       Inc(I);
  1292.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1293.     end;
  1294.  
  1295.     { Erase pixels }
  1296.     RandSeed := Seed;
  1297.     I := 0;
  1298.     while (not KeyPressed) and (I < NumPts) do
  1299.     begin
  1300.       Inc(I);
  1301.       X := Random(XMax)+1;
  1302.       Y := Random(YMax)+1;
  1303.       Color := GetPixel(X, Y);
  1304.         if Color = RandColor then
  1305.           PutPixel(X, Y, 0);
  1306.      end;
  1307.   end;
  1308.   WaitToGo;
  1309. end; { PutPixelPlay }
  1310.  
  1311. procedure PutImagePlay;
  1312. { Demonstrate the GetImage and PutImage commands }
  1313.  
  1314. const
  1315.   r  = 20;
  1316.   StartX = 100;
  1317.   StartY = 50;
  1318.  
  1319. var
  1320.   CurPort : ViewPortType;
  1321.  
  1322. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1323. var
  1324.   Step : integer;
  1325. begin
  1326.   Step := Random(2*r);
  1327.   if Odd(Step) then
  1328.     Step := -Step;
  1329.   X := X + Step;
  1330.   Step := Random(r);
  1331.   if Odd(Step) then
  1332.     Step := -Step;
  1333.   Y := Y + Step;
  1334.  
  1335.   { Make saucer bounce off viewport walls }
  1336.   with CurPort do
  1337.   begin
  1338.     if (x1 + X + Width - 1 > x2) then
  1339.       X := x2-x1 - Width + 1
  1340.     else
  1341.       if (X < 0) then
  1342.         X := 0;
  1343.     if (y1 + Y + Height - 1 > y2) then
  1344.       Y := y2-y1 - Height + 1
  1345.     else
  1346.       if (Y < 0) then
  1347.         Y := 0;
  1348.   end;
  1349. end; { MoveSaucer }
  1350.  
  1351. var
  1352.   Pausetime : word;
  1353.   Saucer    : pointer;
  1354.   X, Y      : integer;
  1355.   ulx, uly  : word;
  1356.   lrx, lry  : word;
  1357.   Size      : word;
  1358.   I         : word;
  1359. begin
  1360.   ClearDevice;
  1361.   FullPort;
  1362.  
  1363.   { PaintScreen }
  1364.   ClearDevice;
  1365.   MainWindow('GetImage / PutImage Demonstration');
  1366.   StatusLine('Esc aborts or press a key...');
  1367.   GetViewSettings(CurPort);
  1368.  
  1369.   { DrawSaucer }
  1370.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1371.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1372.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1373.   Circle(StartX+10, StartY-12, 2);
  1374.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1375.   Circle(StartX-10, StartY-12, 2);
  1376.   SetFillStyle(SolidFill, MaxColor);
  1377.   FloodFill(StartX+1, StartY+4, GetColor);
  1378.  
  1379.   { ReadSaucerImage }
  1380.   ulx := StartX-(r+1);
  1381.   uly := StartY-14;
  1382.   lrx := StartX+(r+1);
  1383.   lry := StartY+(r div 3)+3;
  1384.  
  1385.   Size := ImageSize(ulx, uly, lrx, lry);
  1386.   GetMem(Saucer, Size);
  1387.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1388. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1389.  
  1390.   { Plot some "stars" }
  1391.   for I := 1 to 1000 do
  1392.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1393.   X := MaxX div 2;
  1394.   Y := MaxY div 2;
  1395.   PauseTime := 70;
  1396.  
  1397.   { Move the saucer around }
  1398.   repeat
  1399. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1400.      Delay(PauseTime);
  1401. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1402.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1403.   until KeyPressed;
  1404.   FreeMem(Saucer, size);
  1405.   WaitToGo;
  1406. end; { PutImagePlay }
  1407.  
  1408. procedure PolyPlay;
  1409. { Draw random polygons with random fill styles on the screen }
  1410. const
  1411.   MaxPts = 5;
  1412. type
  1413.   PolygonType = array[1..MaxPts] of PointType;
  1414. var
  1415.   Poly : PolygonType;
  1416.   I, Color : word;
  1417. begin
  1418.   MainWindow('FillPoly demonstration');
  1419.   StatusLine('Esc aborts or press a key...');
  1420.   repeat
  1421.     Color := RandColor;
  1422.     SetFillStyle(Random(11)+1, Color);
  1423.     SetColor(Color);
  1424.     for I := 1 to MaxPts do
  1425.       with Poly[I] do
  1426.       begin
  1427.         X := Random(MaxX);
  1428.         Y := Random(MaxY);
  1429.       end;
  1430.     FillPoly(MaxPts, Poly);
  1431.   until KeyPressed;
  1432.   WaitToGo;
  1433. end; { PolyPlay }
  1434.  
  1435. procedure FillStylePlay;
  1436. { Display all of the predefined fill styles available }
  1437. var
  1438.   Style    : word;
  1439.   Width    : word;
  1440.   Height   : word;
  1441.   X, Y     : word;
  1442.   I, J     : word;
  1443.   ViewInfo : ViewPortType;
  1444.  
  1445. procedure DrawBox(X, Y : word);
  1446. begin
  1447.   SetFillStyle(Style, MaxColor);
  1448.   with ViewInfo do
  1449.     Bar(X, Y, X+Width, Y+Height);
  1450.   Rectangle(X, Y, X+Width, Y+Height);
  1451.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1452.   Inc(Style);
  1453. end; { DrawBox }
  1454.  
  1455. begin
  1456.   MainWindow('Pre-defined fill styles');
  1457.   GetViewSettings(ViewInfo);
  1458.   with ViewInfo do
  1459.   begin
  1460.     Width := 2 * ((x2+1) div 13);
  1461.     Height := 2 * ((y2-10) div 10);
  1462.   end;
  1463.   X := Width div 2;
  1464.   Y := Height div 2;
  1465.   Style := 0;
  1466.   for J := 1 to 3 do
  1467.   begin
  1468.     for I := 1 to 4 do
  1469.     begin
  1470.       DrawBox(X, Y);
  1471.       Inc(X, (Width div 2) * 3);
  1472.     end;
  1473.     X := Width div 2;
  1474.     Inc(Y, (Height div 2) * 3);
  1475.   end;
  1476.   SetTextJustify(LeftText, TopText);
  1477.   WaitToGo;
  1478. end; { FillStylePlay }
  1479.  
  1480. procedure FillPatternPlay;
  1481. { Display some user defined fill patterns }
  1482. const
  1483.   Patterns : array[0..11] of FillPatternType = (
  1484.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1485.             OldColor which has a path of pixels of OldColor or NewColor
  1486.             with sides touching back to the seed point, (XSeed, YSeed).
  1487.             Therefore, only pixels of OldColor are modified and no other
  1488.             information is changed.
  1489.  
  1490.             SEE ALSO
  1491.  
  1492.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  1493.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  1494.             SETVIEW
  1495.  
  1496.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  1497.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  1498.             IF WHICHVGA = 0 THEN STOP
  1499.             DUMMY=RES640
  1500.             SETVIEW 100, 100, 539, 379
  1501.             FILLVIEW 10
  1502.             WHILE INKEY$ = ""
  1503.             WEND
  1504.             VIDEOMODESET VMODE
  1505.             END
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                                                                          63
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.           FONTGETINFO
  1530.  
  1531.             PROTOTYPE
  1532.  
  1533.             SUB FONTGETINFO (Width%, Height%)
  1534.  
  1535.             INPUT
  1536.  
  1537.             no input parameters
  1538.     WEND
  1539.             MOUSEEXIT
  1540.             VIDEOMODESET VMODE
  1541.             END
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.                                                                          86
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.           MOUSECURSORDEFAULT
  1590.  
  1591.             PROTOTYPE
  1592.  
  1593.             SUB MOUSECURSORDEFAULT ()
  1594.  
  1595.             INPUT
  1596.  
  1597.             no input parameters
  1598.  
  1599.             OUTPUT
  1600.  
  1601.             no value returned
  1602.  
  1603.             USAGE
  1604.  
  1605.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1606.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  1607. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1608. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  1609. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1610. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1611. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1612. $╤
  1613. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  1614. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  1615. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1616. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1617. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  1618. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  1619. ░£▒
  1620. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  1621. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1622.       end;
  1623.     end;
  1624.   end;
  1625.   WaitToGo;
  1626. end; { UserLineStylePlay }
  1627.  
  1628.  
  1629. procedure SayGoodbye;
  1630. { Say goodbye and then exit the program }
  1631. var
  1632.   ViewInfo : ViewPortType;
  1633. begin
  1634.   MainWindow('');
  1635.   GetViewSettings(ViewInfo);
  1636.   SetTextStyle(TriplexFont, HorizDir, 4);
  1637.   SetTextJustify(CenterText, CenterText);
  1638.   with ViewInfo do
  1639.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1640.   StatusLine('Press any key to quit...');
  1641.   repeat until KeyPressed;
  1642. end; { SayGoodbye }
  1643.  
  1644.  
  1645. PROCEDURE SelectMode;
  1646. VAR
  1647.     choice1,choice2     : CHAR;
  1648.    xsize,ysize            : WORD;
  1649. BEGIN
  1650.     (* Let's select a mode *)
  1651.     ClrScr;
  1652.     WriteLn('VESADEMO:');
  1653.     WriteLn('1. 256 colors');
  1654.     WriteLn('2. 32768 colors');
  1655.     WriteLn('3. 65536 colors');
  1656.     WriteLn('4. 16777216 colors');
  1657.     WriteLn('Q uit');
  1658.     WriteLn;
  1659.     Write('Your choice: ');
  1660.     REPEAT
  1661.         ReadLn(choice1);
  1662.       IF choice1 <> '1' THEN BEGIN
  1663.           WriteLn('Sorry !');
  1664.          WriteLn('This demo wasn''t written for more as 256 colors !');
  1665.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  1666.          WriteLn('Switching to 256 colors.');
  1667.          choice1 := '1';
  1668.       END;
  1669.     UNTIL choice1 IN ['1'..'4','q'];
  1670.     IF choice1 = 'q' THEN Halt;
  1671.  
  1672.     WriteLn;
  1673.     WriteLn;
  1674.     WriteLn('a. 320x200');
  1675.     WriteLn('b. 640x480');
  1676.     WriteLn('c. 800x600');
  1677.     WriteLn('d. 1024x768');
  1678.     WriteLn('e. 1280x1024');
  1679.     WriteLn('Q uit');
  1680.     WriteLn;
  1681.     Write('Your choice: ');
  1682.     REPEAT
  1683.         ReadLn(choice2);
  1684.     UNTIL choice2 IN ['a'..'e','q'];
  1685.     IF choice2 = 'q' THEN Halt;
  1686.  
  1687.     CASE choice2 OF
  1688.         'a' : BEGIN
  1689.             xsize := 320;
  1690.             ysize := 200;
  1691.         END;
  1692.         'b' : BEGIN
  1693.             xsize := 640;
  1694.             ysize := 480;
  1695.         END;
  1696.         'c' : BEGIN
  1697.             xsize := 800;
  1698.             ysize := 600;
  1699.         END;
  1700.         'd' : BEGIN
  1701.             xsize := 1024;
  1702.             ysize := 768;
  1703.         END;
  1704.         'e' : BEGIN
  1705.             xsize := 1280;
  1706.             ysize := 1024;
  1707.         END;
  1708.     END;
  1709.     CASE choice1 OF
  1710.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1711.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1712.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1713.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1714.     END;
  1715.     IF mode = 0 THEN BEGIN
  1716.         WriteLn('No such mode could be found !');
  1717.         WriteLn('Switching to to 320x200.');
  1718.         ReadKey;
  1719.         mode := V320x200x256;
  1720.     END;
  1721. END;
  1722.  
  1723. begin { program body }
  1724.   SelectMode;
  1725.   Initialize;
  1726.   ReportStatus;
  1727.  
  1728. {  AspectRatioPlay; }
  1729.   FillEllipsePlay;
  1730.   SectorPlay;
  1731.   WriteModePlay;
  1732.  
  1733.   ColorPlay;
  1734.   { PalettePlay only intended to work on these drivers: }
  1735.   if (GraphDriver = EGA) or
  1736.       (GraphDriver = EGA64) or
  1737.       (GraphDriver = VGA) then
  1738.      PalettePlay;
  1739.   PutPixelPlay;
  1740. {  PutImagePlay; }
  1741.   RandBarPlay;
  1742.   BarPlay;
  1743.   Bar3DPlay;
  1744.   ArcPlay;
  1745.   CirclePlay;
  1746.   PiePlay;
  1747.   LineToPlay;
  1748.   LineRelPlay;
  1749. {  LineStylePlay; }
  1750. {  UserLineStylePlay; }
  1751.   TextDump;
  1752.   TextPlay;
  1753.   CrtModePlay;
  1754.   FillStylePlay;
  1755.   FillPatternPlay;
  1756.   PolyPlay;
  1757.   SayGoodbye;
  1758. {  CloseGraph; }
  1759.   CloseVesa;
  1760. end.
  1761. ***************************************************
  1762.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1763.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  1764. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  1765. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1766. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1767. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1768.     Color := RandColor;
  1769.     SetColor(Color);
  1770.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1771.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1772.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1773.   until KeyPressed;
  1774.   WaitToGo;
  1775. end; { RandBarPlay }
  1776.  
  1777. procedure ArcPlay;
  1778. { Draw random arcs on the screen }
  1779. var
  1780.   MaxRadius : word;
  1781.   EndAngle : word;
  1782.   ArcInfo : ArcCoordsType;
  1783. begin
  1784.   MainWindow('Arc / GetArcCoords demonstration');
  1785.   StatusLine('Esc aborts or press a key');
  1786.   MaxRadius := MaxY div 10;
  1787.   repeat
  1788.     SetColor(RandColor);
  1789.     EndAngle := Random(360);
  1790.     SetLineStyle(SolidLn, 0, NormWidth);
  1791.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1792.     GetArcCoords(ArcInfo);
  1793.     with ArcInfo do
  1794.     begin
  1795.       Line(X, Y, XStart, YStart);
  1796.       Line(X, Y, Xend, Yend);
  1797.     end;
  1798.   until KeyPressed;
  1799.   WaitToGo;
  1800. end; { ArcPlay }
  1801.  
  1802. procedure PutPixelPlay;
  1803. { Demonstrate the PutPixel and GetPixel commands }
  1804. const
  1805.   Seed   = 1962; { A seed for the random number generator }
  1806.   NumPts = 2000; { The number of pixels plotted }
  1807.   Esc    = #27;
  1808. var
  1809.   I : word;
  1810.   X, Y, Color : word;
  1811.   XMax, YMax  : integer;
  1812.   ViewInfo    : ViewPortType;
  1813. begin
  1814.   MainWindow('PutPixel / GetPixel demonstration');
  1815.   StatusLine('Esc aborts or press a key...');
  1816.  
  1817.   GetViewSettings(ViewInfo);
  1818.   with ViewInfo do
  1819.   begin
  1820.     XMax := (x2-x1-1);
  1821.     YMax := (y2-y1-1);
  1822.   end;
  1823.  
  1824.   while not KeyPressed do
  1825.   begin
  1826.     { Plot random pixels }
  1827.     RandSeed := Seed;
  1828.     I := 0;
  1829.     while (not KeyPressed) and (I < NumPts) do
  1830.     begin
  1831.       Inc(I);
  1832.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1833.     end;
  1834.  
  1835.     { Erase pixels }
  1836.     RandSeed := Seed;
  1837.     I := 0;
  1838.     while (not KeyPressed) and (I < NumPts) do
  1839.     begin
  1840.       Inc(I);
  1841.       X := Random(XMax)+1;
  1842.       Y := Random(YMax)+1;
  1843.       Color := GetPixel(X, Y);
  1844.         if Color = RandColor then
  1845.           PutPixel(X, Y, 0);
  1846.      end;
  1847.   end;
  1848.   WaitToGo;
  1849. end; { PutPixelPlay }
  1850.  
  1851. procedure PutImagePlay;
  1852. { Demonstrate the GetImage and PutImage commands }
  1853.  
  1854. const
  1855.   r  = 20;
  1856.   StartX = 100;
  1857.   StartY = 50;
  1858.  
  1859. var
  1860.   CurPort : ViewPortType;
  1861.  
  1862. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1863. var
  1864.   Step : integer;
  1865. begin
  1866.   Step := Random(2*r);
  1867.   if Odd(Step) then
  1868.     Step := -Step;
  1869.   X := X + Step;
  1870.   Step := Random(r);
  1871.   if Odd(Step) then
  1872.     Step := -Step;
  1873.   Y := Y + Step;
  1874.  
  1875.   { Make saucer bounce off viewport walls }
  1876.   with CurPort do
  1877.   begin
  1878.     if (x1 + X + Width - 1 > x2) then
  1879.       X := x2-x1 - Width + 1
  1880.     else
  1881.       if (X < 0) then
  1882.         X := 0;
  1883.     if (y1 + Y + Height - 1 > y2) then
  1884.       Y := y2-y1 - Height + 1
  1885.     else
  1886.       if (Y < 0) then
  1887.         Y := 0;
  1888.   end;
  1889. end; { MoveSaucer }
  1890.  
  1891. var
  1892.   Pausetime : word;
  1893.   Saucer    : pointer;
  1894.   X, Y      : integer;
  1895.   ulx, uly  : word;
  1896.   lrx, lry  : word;
  1897.   Size      : word;
  1898.   I         : word;
  1899. begin
  1900.   ClearDevice;
  1901.   FullPort;
  1902.  
  1903.   { PaintScreen }
  1904.   ClearDevice;
  1905.   MainWindow('GetImage / PutImage Demonstration');
  1906.   StatusLine('Esc aborts or press a key...');
  1907.   GetViewSettings(CurPort);
  1908.  
  1909.   { DrawSaucer }
  1910.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1911.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1912.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1913.   Circle(StartX+10, StartY-12, 2);
  1914.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1915.   Circle(StartX-10, StartY-12, 2);
  1916.   SetFillStyle(SolidFill, MaxColor);
  1917.   FloodFill(StartX+1, StartY+4, GetColor);
  1918.  
  1919.   { ReadSaucerImage }
  1920.   ulx := StartX-(r+1);
  1921.   uly := StartY-14;
  1922.   lrx := StartX+(r+1);
  1923.   lry := StartY+(r div 3)+3;
  1924.  
  1925.   Size := ImageSize(ulx, uly, lrx, lry);
  1926.   GetMem(Saucer, Size);
  1927.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1928. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1929.  
  1930.   { Plot some "stars" }
  1931.   for I := 1 to 1000 do
  1932.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1933.   X := MaxX div 2;
  1934.   Y := MaxY div 2;
  1935.   PauseTime := 70;
  1936.  
  1937.   { Move the saucer around }
  1938.   repeat
  1939. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1940.      Delay(PauseTime);
  1941. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1942.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1943.   until KeyPressed;
  1944.   FreeMem(Saucer, size);
  1945.   WaitToGo;
  1946. end; { PutImagePlay }
  1947.  
  1948. procedure PolyPlay;
  1949. { Draw random polygons with random fill styles on the screen }
  1950. const
  1951.   MaxPts = 5;
  1952. type
  1953.   PolygonType = array[1..MaxPts] of PointType;
  1954. var
  1955.   Poly : PolygonType;
  1956.   I, Color : word;
  1957. begin
  1958.   MainWindow('FillPoly demonstration');
  1959.   StatusLine('Esc aborts or press a key...');
  1960.   repeat
  1961.     Color := RandColor;
  1962.     SetFillStyle(Random(11)+1, Color);
  1963.     SetColor(Color);
  1964.     for I := 1 to MaxPts do
  1965.       with Poly[I] do
  1966.       begin
  1967.         X := Random(MaxX);
  1968.         Y := Random(MaxY);
  1969.       end;
  1970.     FillPoly(MaxPts, Poly);
  1971.   until KeyPressed;
  1972.   WaitToGo;
  1973. end; { PolyPlay }
  1974.  
  1975. procedure FillStylePlay;
  1976. { Display all of the predefined fill styles available }
  1977. var
  1978.   Style    : word;
  1979.   Width    : word;
  1980.   Height   : word;
  1981.   X, Y     : word;
  1982.   I, J     : word;
  1983.   ViewInfo : ViewPortType;
  1984.  
  1985. procedure DrawBox(X, Y : word);
  1986. begin
  1987.   SetFillStyle(Style, MaxColor);
  1988.   with ViewInfo do
  1989.     Bar(X, Y, X+Width, Y+Height);
  1990.   Rectangle(X, Y, X+Width, Y+Height);
  1991.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1992.   Inc(Style);
  1993. end; { DrawBox }
  1994.  
  1995. begin
  1996.   MainWindow('Pre-defined fill styles');
  1997.   GetViewSettings(ViewInfo);
  1998.   with ViewInfo do
  1999.   begin
  2000.     Width := 2 * ((x2+1) div 13);
  2001.     Height := 2 * ((y2-10) div 10);
  2002.   end;
  2003.   X := Width div 2;
  2004.   Y := Height div 2;
  2005.   Style := 0;
  2006.   for J := 1 to 3 do
  2007.   begin
  2008.     for I := 1 to 4 do
  2009.     begin
  2010.       DrawBox(X, Y);
  2011.       Inc(X, (Width div 2) * 3);
  2012.     end;
  2013.     X := Width div 2;
  2014.     Inc(Y, (Height div 2) * 3);
  2015.   end;
  2016.   SetTextJustify(LeftText, TopText);
  2017.   WaitToGo;
  2018. end; { FillStylePlay }
  2019.  
  2020. procedure FillPatternPlay;
  2021. { Display some user defined fill patterns }
  2022. const
  2023.   Patterns : array[0..11] of FillPatternType = (
  2024.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  2025.             OldColor which has a path of pixels of OldColor or NewColor
  2026.             with sides touching back to the seed point, (XSeed, YSeed).
  2027.             Therefore, only pixels of OldColor are modified and no other
  2028.             information is changed.
  2029.  
  2030.             SEE ALSO
  2031.  
  2032.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  2033.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  2034.             SETVIEW
  2035.  
  2036.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  2037.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  2038.             IF WHICHVGA = 0 THEN STOP
  2039.             DUMMY=RES640
  2040.             SETVIEW 100, 100, 539, 379
  2041.             FILLVIEW 10
  2042.             WHILE INKEY$ = ""
  2043.             WEND
  2044.             VIDEOMODESET VMODE
  2045.             END
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.                                                                          63
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.           FONTGETINFO
  2070.  
  2071.             PROTOTYPE
  2072.  
  2073.             SUB FONTGETINFO (Width%, Height%)
  2074.  
  2075.             INPUT
  2076.  
  2077.             no input parameters
  2078.     WEND
  2079.             MOUSEEXIT
  2080.             VIDEOMODESET VMODE
  2081.             END
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.                                                                          86
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.           MOUSECURSORDEFAULT
  2130.  
  2131.             PROTOTYPE
  2132.  
  2133.             SUB MOUSECURSORDEFAULT ()
  2134.  
  2135.             INPUT
  2136.  
  2137.             no input parameters
  2138.  
  2139.             OUTPUT
  2140.  
  2141.             no value returned
  2142.  
  2143.             USAGE
  2144.  
  2145.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  2146.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  2147. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  2148. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  2149. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  2150. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  2151. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  2152. $╤
  2153. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  2154. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  2155. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  2156. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  2157. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  2158. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  2159. ░£▒
  2160. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  2161. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  2162.       end;
  2163.     end;
  2164.   end;
  2165.   WaitToGo;
  2166. end; { UserLineStylePlay }
  2167.  
  2168.  
  2169. procedure SayGoodbye;
  2170. { Say goodbye and then exit the program }
  2171. var
  2172.   ViewInfo : ViewPortType;
  2173. begin
  2174.   MainWindow('');
  2175.   GetViewSettings(ViewInfo);
  2176.   SetTextStyle(TriplexFont, HorizDir, 4);
  2177.   SetTextJustify(CenterText, CenterText);
  2178.   with ViewInfo do
  2179.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  2180.   StatusLine('Press any key to quit...');
  2181.   repeat until KeyPressed;
  2182. end; { SayGoodbye }
  2183.  
  2184.  
  2185. PROCEDURE SelectMode;
  2186. VAR
  2187.     choice1,choice2     : CHAR;
  2188.    xsize,ysize            : WORD;
  2189. BEGIN
  2190.     (* Let's select a mode *)
  2191.     ClrScr;
  2192.     WriteLn('VESADEMO:');
  2193.     WriteLn('1. 256 colors');
  2194.     WriteLn('2. 32768 colors');
  2195.     WriteLn('3. 65536 colors');
  2196.     WriteLn('4. 16777216 colors');
  2197.     WriteLn('Q uit');
  2198.     WriteLn;
  2199.     Write('Your choice: ');
  2200.     REPEAT
  2201.         ReadLn(choice1);
  2202.       IF choice1 <> '1' THEN BEGIN
  2203.           WriteLn('Sorry !');
  2204.          WriteLn('This demo wasn''t written for more as 256 colors !');
  2205.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  2206.          WriteLn('Switching to 256 colors.');
  2207.          choice1 := '1';
  2208.       END;
  2209.     UNTIL choice1 IN ['1'..'4','q'];
  2210.     IF choice1 = 'q' THEN Halt;
  2211.  
  2212.     WriteLn;
  2213.     WriteLn;
  2214.     WriteLn('a. 320x200');
  2215.     WriteLn('b. 640x480');
  2216.     WriteLn('c. 800x600');
  2217.     WriteLn('d. 1024x768');
  2218.     WriteLn('e. 1280x1024');
  2219.     WriteLn('Q uit');
  2220.     WriteLn;
  2221.     Write('Your choice: ');
  2222.     REPEAT
  2223.         ReadLn(choice2);
  2224.     UNTIL choice2 IN ['a'..'e','q'];
  2225.     IF choice2 = 'q' THEN Halt;
  2226.  
  2227.     CASE choice2 OF
  2228.         'a' : BEGIN
  2229.             xsize := 320;
  2230.             ysize := 200;
  2231.         END;
  2232.         'b' : BEGIN
  2233.             xsize := 640;
  2234.             ysize := 480;
  2235.         END;
  2236.         'c' : BEGIN
  2237.             xsize := 800;
  2238.             ysize := 600;
  2239.         END;
  2240.         'd' : BEGIN
  2241.             xsize := 1024;
  2242.             ysize := 768;
  2243.         END;
  2244.         'e' : BEGIN
  2245.             xsize := 1280;
  2246.             ysize := 1024;
  2247.         END;
  2248.     END;
  2249.     CASE choice1 OF
  2250.         '1' : mode := FindVesaMode(xsize,ysize,8);
  2251.         '2' : mode := FindVesaMode(xsize,ysize,15);
  2252.         '3' : mode := FindVesaMode(xsize,ysize,16);
  2253.         '4' : mode := FindVesaMode(xsize,ysize,24);
  2254.     END;
  2255.     IF mode = 0 THEN BEGIN
  2256.         WriteLn('No such mode could be found !');
  2257.         WriteLn('Switching to to 320x200.');
  2258.         ReadKey;
  2259.         mode := V320x200x256;
  2260.     END;
  2261. END;
  2262.  
  2263. begin { program body }
  2264.   SelectMode;
  2265.   Initialize;
  2266.   ReportStatus;
  2267.  
  2268. {  AspectRatioPlay; }
  2269.   FillEllipsePlay;
  2270.   SectorPlay;
  2271.   WriteModePlay;
  2272.  
  2273.   ColorPlay;
  2274.   { PalettePlay only intended to work on these drivers: }
  2275.   if (GraphDriver = EGA) or
  2276.       (GraphDriver = EGA64) or
  2277.       (GraphDriver = VGA) then
  2278.      PalettePlay;
  2279.   PutPixelPlay;
  2280. {  PutImagePlay; }
  2281.   RandBarPlay;
  2282.   BarPlay;
  2283.   Bar3DPlay;
  2284.   ArcPlay;
  2285.   CirclePlay;
  2286.   PiePlay;
  2287.   LineToPlay;
  2288.   LineRelPlay;
  2289. {  LineStylePlay; }
  2290. {  UserLineStylePlay; }
  2291.   TextDump;
  2292.   TextPlay;
  2293.   CrtModePlay;
  2294.   FillStylePlay;
  2295.   FillPatternPlay;
  2296.   PolyPlay;
  2297.   SayGoodbye;
  2298. {  CloseGraph; }
  2299.   CloseVesa;
  2300. end.
  2301. ***************************************************
  2302.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  2303.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  2304. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  2305. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  2306. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  2307. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  2308.     Color := RandColor;
  2309.     SetColor(Color);
  2310.     SetFillStyle(Random(CloseDotFill)+1, Color);
  2311.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  2312.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  2313.   until KeyPressed;
  2314.   WaitToGo;
  2315. end; { RandBarPlay }
  2316.  
  2317. procedure ArcPlay;
  2318. { Draw random arcs on the screen }
  2319. var
  2320.   MaxRadius : word;
  2321.   EndAngle : word;
  2322.   ArcInfo : ArcCoordsType;
  2323. begin
  2324.   MainWindow('Arc / GetArcCoords demonstration');
  2325.   StatusLine('Esc aborts or press a key');
  2326.   MaxRadius := MaxY div 10;
  2327.   repeat
  2328.     SetColor(RandColor);
  2329.     EndAngle := Random(360);
  2330.     SetLineStyle(SolidLn, 0, NormWidth);
  2331.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  2332.     GetArcCoords(ArcInfo);
  2333.     with ArcInfo do
  2334.     begin
  2335.       Line(X, Y, XStart, YStart);
  2336.       Line(X, Y, Xend, Yend);
  2337.     end;
  2338.   until KeyPressed;
  2339.   WaitToGo;
  2340. end; { ArcPlay }
  2341.  
  2342. procedure PutPixelPlay;
  2343. { Demonstrate the PutPixel and GetPixel commands }
  2344. const
  2345.   Seed   = 1962; { A seed for the random number generator }
  2346.   NumPts = 2000; { The number of pixels plotted }
  2347.   Esc    = #27;
  2348. var
  2349.   I : word;
  2350.   X, Y, Color : word;
  2351.   XMax, YMax  : integer;
  2352.   ViewInfo    : ViewPortType;
  2353. begin
  2354.   MainWindow('PutPixel / GetPixel demonstration');
  2355.   StatusLine('Esc aborts or press a key...');
  2356.  
  2357.   GetViewSettings(ViewInfo);
  2358.   with ViewInfo do
  2359.   begin
  2360.     XMax := (x2-x1-1);
  2361.     YMax := (y2-y1-1);
  2362.   end;
  2363.  
  2364.   while not KeyPressed do
  2365.   begin
  2366.     { Plot random pixels }
  2367.     RandSeed := Seed;
  2368.     I := 0;
  2369.     while (not KeyPressed) and (I < NumPts) do
  2370.     begin
  2371.       Inc(I);
  2372.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  2373.     end;
  2374.  
  2375.     { Erase pixels }
  2376.     RandSeed := Seed;
  2377.     I := 0;
  2378.     while (not KeyPressed) and (I < NumPts) do
  2379.     begin
  2380.       Inc(I);
  2381.       X := Random(XMax)+1;
  2382.       Y := Random(YMax)+1;
  2383.       Color := GetPixel(X, Y);
  2384.         if Color = RandColor then
  2385.           PutPixel(X, Y, 0);
  2386.      end;
  2387.   end;
  2388.   WaitToGo;
  2389. end; { PutPixelPlay }
  2390.  
  2391. procedure PutImagePlay;
  2392. { Demonstrate the GetImage and PutImage commands }
  2393.  
  2394. const
  2395.   r  = 20;
  2396.   StartX = 100;
  2397.   StartY = 50;
  2398.  
  2399. var
  2400.   CurPort : ViewPortType;
  2401.  
  2402. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  2403. var
  2404.   Step : integer;
  2405. begin
  2406.   Step := Random(2*r);
  2407.   if Odd(Step) then
  2408.     Step := -Step;
  2409.   X := X + Step;
  2410.   Step := Random(r);
  2411.   if Odd(Step) then
  2412.     Step := -Step;
  2413.   Y := Y + Step;
  2414.  
  2415.   { Make saucer bounce off viewport walls }
  2416.   with CurPort do
  2417.   begin
  2418.     if (x1 + X + Width - 1 > x2) then
  2419.       X := x2-x1 - Width + 1
  2420.     else
  2421.       if (X < 0) then
  2422.         X := 0;
  2423.     if (y1 + Y + Height - 1 > y2) then
  2424.       Y := y2-y1 - Height + 1
  2425.     else
  2426.       if (Y < 0) then
  2427.         Y := 0;
  2428.   end;
  2429. end; { MoveSaucer }
  2430.  
  2431. var
  2432.   Pausetime : word;
  2433.   Saucer    : pointer;
  2434.   X, Y      : integer;
  2435.   ulx, uly  : word;
  2436.   lrx, lry  : word;
  2437.   Size      : word;
  2438.   I         : word;
  2439. begin
  2440.   ClearDevice;
  2441.   FullPort;
  2442.  
  2443.   { PaintScreen }
  2444.   ClearDevice;
  2445.   MainWindow('GetImage / PutImage Demonstration');
  2446.   StatusLine('Esc aborts or press a key...');
  2447.   GetViewSettings(CurPort);
  2448.  
  2449.   { DrawSaucer }
  2450.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  2451.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  2452.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  2453.   Circle(StartX+10, StartY-12, 2);
  2454.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  2455.   Circle(StartX-10, StartY-12, 2);
  2456.   SetFillStyle(SolidFill, MaxColor);
  2457.   FloodFill(StartX+1, StartY+4, GetColor);
  2458.  
  2459.   { ReadSaucerImage }
  2460.   ulx := StartX-(r+1);
  2461.   uly := StartY-14;
  2462.   lrx := StartX+(r+1);
  2463.   lry := StartY+(r div 3)+3;
  2464.  
  2465.   Size := ImageSize(ulx, uly, lrx, lry);
  2466.   GetMem(Saucer, Size);
  2467.   GetImage(ulx, uly, lrx, lry, Saucer^);
  2468. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  2469.  
  2470.   { Plot some "stars" }
  2471.   for I := 1 to 1000 do
  2472.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  2473.   X := MaxX div 2;
  2474.   Y := MaxY div 2;
  2475.   PauseTime := 70;
  2476.  
  2477.   { Move the saucer around }
  2478.   repeat
  2479. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  2480.      Delay(PauseTime);
  2481. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  2482.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  2483.   until KeyPressed;
  2484.   FreeMem(Saucer, size);
  2485.   WaitToGo;
  2486. end; { PutImagePlay }
  2487.  
  2488. procedure PolyPlay;
  2489. { Draw random polygons with random fill styles on the screen }
  2490. const
  2491.   MaxPts = 5;
  2492. type
  2493.   PolygonType = array[1..MaxPts] of PointType;
  2494. var
  2495.   Poly : PolygonType;
  2496.   I, Color : word;
  2497. begin
  2498.   MainWindow('FillPoly demonstration');
  2499.   StatusLine('Esc aborts or press a key...');
  2500.   repeat
  2501.     Color := RandColor;
  2502.     SetFillStyle(Random(11)+1, Color);
  2503.     SetColor(Color);
  2504.     for I := 1 to MaxPts do
  2505.       with Poly[I] do
  2506.       begin
  2507.         X := Random(MaxX);
  2508.         Y := Random(MaxY);
  2509.       end;
  2510.     FillPoly(MaxPts, Poly);
  2511.   until KeyPressed;
  2512.   WaitToGo;
  2513. end; { PolyPlay }
  2514.  
  2515. procedure FillStylePlay;
  2516. { Display all of the predefined fill styles available }
  2517. var
  2518.   Style    : word;
  2519.   Width    : word;
  2520.   Height   : word;
  2521.   X, Y     : word;
  2522.   I, J     : word;
  2523.   ViewInfo : ViewPortType;
  2524.  
  2525. procedure DrawBox(X, Y : word);
  2526. begin
  2527.   SetFillStyle(Style, MaxColor);
  2528.   with ViewInfo do
  2529.     Bar(X, Y, X+Width, Y+Height);
  2530.   Rectangle(X, Y, X+Width, Y+Height);
  2531.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  2532.   Inc(Style);
  2533. end; { DrawBox }
  2534.  
  2535. begin
  2536.   MainWindow('Pre-defined fill styles');
  2537.   GetViewSettings(ViewInfo);
  2538.   with ViewInfo do
  2539.   begin
  2540.     Width := 2 * ((x2+1) div 13);
  2541.     Height := 2 * ((y2-10) div 10);
  2542.   end;
  2543.   X := Width div 2;
  2544.   Y := Height div 2;
  2545.   Style := 0;
  2546.   for J := 1 to 3 do
  2547.   begin
  2548.     for I := 1 to 4 do
  2549.     begin
  2550.       DrawBox(X, Y);
  2551.       Inc(X, (Width div 2) * 3);
  2552.     end;
  2553.     X := Width div 2;
  2554.     Inc(Y, (Height div 2) * 3);
  2555.   end;
  2556.   SetTextJustify(LeftText, TopText);
  2557.   WaitToGo;
  2558. end; { FillStylePlay }
  2559.  
  2560. procedure FillPatternPlay;
  2561. { Display some user defined fill patterns }
  2562. const
  2563.   Patterns : array[0..11] of FillPatternType = (
  2564.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  2565.             OldColor which has a path of pixels of OldColor or NewColor
  2566.             with sides touching back to the seed point, (XSeed, YSeed).
  2567.             Therefore, only pixels of OldColor are modified and no other
  2568.             information is changed.
  2569.  
  2570.             SEE ALSO
  2571.  
  2572.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  2573.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  2574.             SETVIEW
  2575.  
  2576.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  2577.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  2578.             IF WHICHVGA = 0 THEN STOP
  2579.             DUMMY=RES640
  2580.             SETVIEW 100, 100, 539, 379
  2581.             FILLVIEW 10
  2582.             WHILE INKEY$ = ""
  2583.             WEND
  2584.             VIDEOMODESET VMODE
  2585.             END
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.                                                                          63
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.           FONTGETINFO
  2610.  
  2611.             PROTOTYPE
  2612.  
  2613.             SUB FONTGETINFO (Width%, Height%)
  2614.  
  2615.             INPUT
  2616.  
  2617.             no input parameters
  2618.     WEND
  2619.             MOUSEEXIT
  2620.             VIDEOMODESET VMODE
  2621.             END
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.                                                                          86
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.           MOUSECURSORDEFAULT
  2670.  
  2671.             PROTOTYPE
  2672.  
  2673.             SUB MOUSECURSORDEFAULT ()
  2674.  
  2675.             INPUT
  2676.  
  2677.             no input parameters
  2678.  
  2679.             OUTPUT
  2680.  
  2681.             no value returned
  2682.  
  2683.             USAGE
  2684.  
  2685.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  2686.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  2687. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  2688. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  2689. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  2690. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  2691. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  2692. $╤
  2693. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  2694. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  2695. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  2696. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  2697. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  2698. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  2699. ░£▒
  2700. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  2701. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  2702.       end;
  2703.     end;
  2704.   end;
  2705.   WaitToGo;
  2706. end; { UserLineStylePlay }
  2707.  
  2708.  
  2709. procedure SayGoodbye;
  2710. { Say goodbye and then exit the program }
  2711. var
  2712.   ViewInfo : ViewPortType;
  2713. begin
  2714.   MainWindow('');
  2715.   GetViewSettings(ViewInfo);
  2716.   SetTextStyle(TriplexFont, HorizDir, 4);
  2717.   SetTextJustify(CenterText, CenterText);
  2718.   with ViewInfo do
  2719.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  2720.   StatusLine('Press any key to quit...');
  2721.   repeat until KeyPressed;
  2722. end; { SayGoodbye }
  2723.  
  2724.  
  2725. PROCEDURE SelectMode;
  2726. VAR
  2727.     choice1,choice2     : CHAR;
  2728.    xsize,ysize            : WORD;
  2729. BEGIN
  2730.     (* Let's select a mode *)
  2731.     ClrScr;
  2732.     WriteLn('VESADEMO:');
  2733.     WriteLn('1. 256 colors');
  2734.     WriteLn('2. 32768 colors');
  2735.     WriteLn('3. 65536 colors');
  2736.     WriteLn('4. 16777216 colors');
  2737.     WriteLn('Q uit');
  2738.     WriteLn;
  2739.     Write('Your choice: ');
  2740.     REPEAT
  2741.         ReadLn(choice1);
  2742.       IF choice1 <> '1' THEN BEGIN
  2743.           WriteLn('Sorry !');
  2744.          WriteLn('This demo wasn''t written for more as 256 colors !');
  2745.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  2746.          WriteLn('Switching to 256 colors.');
  2747.          choice1 := '1';
  2748.       END;
  2749.     UNTIL choice1 IN ['1'..'4','q'];
  2750.     IF choice1 = 'q' THEN Halt;
  2751.  
  2752.     WriteLn;
  2753.     WriteLn;
  2754.     WriteLn('a. 320x200');
  2755.     WriteLn('b. 640x480');
  2756.     WriteLn('c. 800x600');
  2757.     WriteLn('d. 1024x768');
  2758.     WriteLn('e. 1280x1024');
  2759.     WriteLn('Q uit');
  2760.     WriteLn;
  2761.     Write('Your choice: ');
  2762.     REPEAT
  2763.         ReadLn(choice2);
  2764.     UNTIL choice2 IN ['a'..'e','q'];
  2765.     IF choice2 = 'q' THEN Halt;
  2766.  
  2767.     CASE choice2 OF
  2768.         'a' : BEGIN
  2769.             xsize := 320;
  2770.             ysize := 200;
  2771.         END;
  2772.         'b' : BEGIN
  2773.             xsize := 640;
  2774.             ysize := 480;
  2775.         END;
  2776.         'c' : BEGIN
  2777.             xsize := 800;
  2778.             ysize := 600;
  2779.         END;
  2780.         'd' : BEGIN
  2781.             xsize := 1024;
  2782.             ysize := 768;
  2783.         END;
  2784.         'e' : BEGIN
  2785.             xsize := 1280;
  2786.             ysize := 1024;
  2787.         END;
  2788.     END;
  2789.     CASE choice1 OF
  2790.         '1' : mode := FindVesaMode(xsize,ysize,8);
  2791.         '2' : mode := FindVesaMode(xsize,ysize,15);
  2792.         '3' : mode := FindVesaMode(xsize,ysize,16);
  2793.         '4' : mode := FindVesaMode(xsize,ysize,24);
  2794.     END;
  2795.     IF mode = 0 THEN BEGIN
  2796.         WriteLn('No such mode could be found !');
  2797.         WriteLn('Switching to to 320x200.');
  2798.         ReadKey;
  2799.         mode := V320x200x256;
  2800.     END;
  2801. END;
  2802.  
  2803. begin { program body }
  2804.   SelectMode;
  2805.   Initialize;
  2806.   ReportStatus;
  2807.  
  2808. {  AspectRatioPlay; }
  2809.   FillEllipsePlay;
  2810.   SectorPlay;
  2811.   WriteModePlay;
  2812.  
  2813.   ColorPlay;
  2814.   { PalettePlay only intended to work on these drivers: }
  2815.   if (GraphDriver = EGA) or
  2816.       (GraphDriver = EGA64) or
  2817.       (GraphDriver = VGA) then
  2818.      PalettePlay;
  2819.   PutPixelPlay;
  2820. {  PutImagePlay; }
  2821.   RandBarPlay;
  2822.   BarPlay;
  2823.   Bar3DPlay;
  2824.   ArcPlay;
  2825.   CirclePlay;
  2826.   PiePlay;
  2827.   LineToPlay;
  2828.   LineRelPlay;
  2829. {  LineStylePlay; }
  2830. {  UserLineStylePlay; }
  2831.   TextDump;
  2832.   TextPlay;
  2833.   CrtModePlay;
  2834.   FillStylePlay;
  2835.   FillPatternPlay;
  2836.   PolyPlay;
  2837.   SayGoodbye;
  2838. {  CloseGraph; }
  2839.   CloseVesa;
  2840. end.
  2841. ***************************************************
  2842.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  2843.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  2844. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  2845. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  2846. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  2847. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  2848.     Color := RandColor;
  2849.     SetColor(Color);
  2850.     SetFillStyle(Random(CloseDotFill)+1, Color);
  2851.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  2852.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  2853.   until KeyPressed;
  2854.   WaitToGo;
  2855. end; { RandBarPlay }
  2856.  
  2857. procedure ArcPlay;
  2858. { Draw random arcs on the screen }
  2859. var
  2860.   MaxRadius : word;
  2861.   EndAngle : word;
  2862.   ArcInfo : ArcCoordsType;
  2863. begin
  2864.   MainWindow('Arc / GetArcCoords demonstration');
  2865.   StatusLine('Esc aborts or press a key');
  2866.   MaxRadius := MaxY div 10;
  2867.   repeat
  2868.     SetColor(RandColor);
  2869.     EndAngle := Random(360);
  2870.     SetLineStyle(SolidLn, 0, NormWidth);
  2871.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  2872.     GetArcCoords(ArcInfo);
  2873.     with ArcInfo do
  2874.     begin
  2875.       Line(X, Y, XStart, YStart);
  2876.       Line(X, Y, Xend, Yend);
  2877.     end;
  2878.   until KeyPressed;
  2879.   WaitToGo;
  2880. end; { ArcPlay }
  2881.  
  2882. procedure PutPixelPlay;
  2883. { Demonstrate the PutPixel and GetPixel commands }
  2884. const
  2885.   Seed   = 1962; { A seed for the random number generator }
  2886.   NumPts = 2000; { The number of pixels plotted }
  2887.   Esc    = #27;
  2888. var
  2889.   I : word;
  2890.   X, Y, Color : word;
  2891.   XMax, YMax  : integer;
  2892.   ViewInfo    : ViewPortType;
  2893. begin
  2894.   MainWindow('PutPixel / GetPixel demonstration');
  2895.   StatusLine('Esc aborts or press a key...');
  2896.  
  2897.   GetViewSettings(ViewInfo);
  2898.   with ViewInfo do
  2899.   begin
  2900.     XMax := (x2-x1-1);
  2901.     YMax := (y2-y1-1);
  2902.   end;
  2903.  
  2904.   while not KeyPressed do
  2905.   begin
  2906.     { Plot random pixels }
  2907.     RandSeed := Seed;
  2908.     I := 0;
  2909.     while (not KeyPressed) and (I < NumPts) do
  2910.     begin
  2911.       Inc(I);
  2912.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  2913.     end;
  2914.  
  2915.     { Erase pixels }
  2916.     RandSeed := Seed;
  2917.     I := 0;
  2918.     while (not KeyPressed) and (I < NumPts) do
  2919.     begin
  2920.       Inc(I);
  2921.       X := Random(XMax)+1;
  2922.       Y := Random(YMax)+1;
  2923.       Color := GetPixel(X, Y);
  2924.         if Color = RandColor then
  2925.           PutPixel(X, Y, 0);
  2926.      end;
  2927.   end;
  2928.   WaitToGo;
  2929. end; { PutPixelPlay }
  2930.  
  2931. procedure PutImagePlay;
  2932. { Demonstrate the GetImage and PutImage commands }
  2933.  
  2934. const
  2935.   r  = 20;
  2936.   StartX = 100;
  2937.   StartY = 50;
  2938.  
  2939. var
  2940.   CurPort : ViewPortType;
  2941.  
  2942. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  2943. var
  2944.   Step : integer;
  2945. begin
  2946.   Step := Random(2*r);
  2947.   if Odd(Step) then
  2948.     Step := -Step;
  2949.   X := X + Step;
  2950.   Step := Random(r);
  2951.   if Odd(Step) then
  2952.     Step := -Step;
  2953.   Y := Y + Step;
  2954.  
  2955.   { Make saucer bounce off viewport walls }
  2956.   with CurPort do
  2957.   begin
  2958.     if (x1 + X + Width - 1 > x2) then
  2959.       X := x2-x1 - Width + 1
  2960.     else
  2961.       if (X < 0) then
  2962.         X := 0;
  2963.     if (y1 + Y + Height - 1 > y2) then
  2964.       Y := y2-y1 - Height + 1
  2965.     else
  2966.       if (Y < 0) then
  2967.         Y := 0;
  2968.   end;
  2969. end; { MoveSaucer }
  2970.  
  2971. var
  2972.   Pausetime : word;
  2973.   Saucer    : pointer;
  2974.   X, Y      : integer;
  2975.   ulx, uly  : word;
  2976.   lrx, lry  : word;
  2977.   Size      : word;
  2978.   I         : word;
  2979. begin
  2980.   ClearDevice;
  2981.   FullPort;
  2982.  
  2983.   { PaintScreen }
  2984.   ClearDevice;
  2985.   MainWindow('GetImage / PutImage Demonstration');
  2986.   StatusLine('Esc aborts or press a key...');
  2987.   GetViewSettings(CurPort);
  2988.  
  2989.   { DrawSaucer }
  2990.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  2991.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  2992.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  2993.   Circle(StartX+10, StartY-12, 2);
  2994.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  2995.   Circle(StartX-10, StartY-12, 2);
  2996.   SetFillStyle(SolidFill, MaxColor);
  2997.   FloodFill(StartX+1, StartY+4, GetColor);
  2998.  
  2999.   { ReadSaucerImage }
  3000.   ulx := StartX-(r+1);
  3001.   uly := StartY-14;
  3002.   lrx := StartX+(r+1);
  3003.   lry := StartY+(r div 3)+3;
  3004.  
  3005.   Size := ImageSize(ulx, uly, lrx, lry);
  3006.   GetMem(Saucer, Size);
  3007.   GetImage(ulx, uly, lrx, lry, Saucer^);
  3008. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  3009.  
  3010.   { Plot some "stars" }
  3011.   for I := 1 to 1000 do
  3012.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  3013.   X := MaxX div 2;
  3014.   Y := MaxY div 2;
  3015.   PauseTime := 70;
  3016.  
  3017.   { Move the saucer around }
  3018.   repeat
  3019. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  3020.      Delay(PauseTime);
  3021. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  3022.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  3023.   until KeyPressed;
  3024.   FreeMem(Saucer, size);
  3025.   WaitToGo;
  3026. end; { PutImagePlay }
  3027.  
  3028. procedure PolyPlay;
  3029. { Draw random polygons with random fill styles on the screen }
  3030. const
  3031.   MaxPts = 5;
  3032. type
  3033.   PolygonType = array[1..MaxPts] of PointType;
  3034. var
  3035.   Poly : PolygonType;
  3036.   I, Color : word;
  3037. begin
  3038.   MainWindow('FillPoly demonstration');
  3039.   StatusLine('Esc aborts or press a key...');
  3040.   repeat
  3041.     Color := RandColor;
  3042.     SetFillStyle(Random(11)+1, Color);
  3043.     SetColor(Color);
  3044.     for I := 1 to MaxPts do
  3045.       with Poly[I] do
  3046.       begin
  3047.         X := Random(MaxX);
  3048.         Y := Random(MaxY);
  3049.       end;
  3050.     FillPoly(MaxPts, Poly);
  3051.   until KeyPressed;
  3052.   WaitToGo;
  3053. end; { PolyPlay }
  3054.  
  3055. procedure FillStylePlay;
  3056. { Display all of the predefined fill styles available }
  3057. var
  3058.   Style    : word;
  3059.   Width    : word;
  3060.   Height   : word;
  3061.   X, Y     : word;
  3062.   I, J     : word;
  3063.   ViewInfo : ViewPortType;
  3064.  
  3065. procedure DrawBox(X, Y : word);
  3066. begin
  3067.   SetFillStyle(Style, MaxColor);
  3068.   with ViewInfo do
  3069.     Bar(X, Y, X+Width, Y+Height);
  3070.   Rectangle(X, Y, X+Width, Y+Height);
  3071.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  3072.   Inc(Style);
  3073. end; { DrawBox }
  3074.  
  3075. begin
  3076.   MainWindow('Pre-defined fill styles');
  3077.   GetViewSettings(ViewInfo);
  3078.   with ViewInfo do
  3079.   begin
  3080.     Width := 2 * ((x2+1) div 13);
  3081.     Height := 2 * ((y2-10) div 10);
  3082.   end;
  3083.   X := Width div 2;
  3084.   Y := Height div 2;
  3085.   Style := 0;
  3086.   for J := 1 to 3 do
  3087.   begin
  3088.     for I := 1 to 4 do
  3089.     begin
  3090.       DrawBox(X, Y);
  3091.       Inc(X, (Width div 2) * 3);
  3092.     end;
  3093.     X := Width div 2;
  3094.     Inc(Y, (Height div 2) * 3);
  3095.   end;
  3096.   SetTextJustify(LeftText, TopText);
  3097.   WaitToGo;
  3098. end; { FillStylePlay }
  3099.  
  3100. procedure FillPatternPlay;
  3101. { Display some user defined fill patterns }
  3102. const
  3103.   Patterns : array[0..11] of FillPatternType = (
  3104.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  3105.             OldColor which has a path of pixels of OldColor or NewColor
  3106.             with sides touching back to the seed point, (XSeed, YSeed).
  3107.             Therefore, only pixels of OldColor are modified and no other
  3108.             information is changed.
  3109.  
  3110.             SEE ALSO
  3111.  
  3112.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3113.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  3114.             SETVIEW
  3115.  
  3116.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  3117.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  3118.             IF WHICHVGA = 0 THEN STOP
  3119.             DUMMY=RES640
  3120.             SETVIEW 100, 100, 539, 379
  3121.             FILLVIEW 10
  3122.             WHILE INKEY$ = ""
  3123.             WEND
  3124.             VIDEOMODESET VMODE
  3125.             END
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.                                                                          63
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.           FONTGETINFO
  3150.  
  3151.             PROTOTYPE
  3152.  
  3153.             SUB FONTGETINFO (Width%, Height%)
  3154.  
  3155.             INPUT
  3156.  
  3157.             no input parameters
  3158.     WEND
  3159.             MOUSEEXIT
  3160.             VIDEOMODESET VMODE
  3161.             END
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.                                                                          86
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.           MOUSECURSORDEFAULT
  3210.  
  3211.             PROTOTYPE
  3212.  
  3213.             SUB MOUSECURSORDEFAULT ()
  3214.  
  3215.             INPUT
  3216.  
  3217.             no input parameters
  3218.  
  3219.             OUTPUT
  3220.  
  3221.             no value returned
  3222.  
  3223.             USAGE
  3224.  
  3225.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  3226.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  3227. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  3228. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  3229. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  3230. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  3231. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  3232. $╤
  3233. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  3234. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  3235. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  3236. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  3237. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  3238. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  3239. ░£▒
  3240. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  3241. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  3242.       end;
  3243.     end;
  3244.   end;
  3245.   WaitToGo;
  3246. end; { UserLineStylePlay }
  3247.  
  3248.  
  3249. procedure SayGoodbye;
  3250. { Say goodbye and then exit the program }
  3251. var
  3252.   ViewInfo : ViewPortType;
  3253. begin
  3254.   MainWindow('');
  3255.   GetViewSettings(ViewInfo);
  3256.   SetTextStyle(TriplexFont, HorizDir, 4);
  3257.   SetTextJustify(CenterText, CenterText);
  3258.   with ViewInfo do
  3259.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  3260.   StatusLine('Press any key to quit...');
  3261.   repeat until KeyPressed;
  3262. end; { SayGoodbye }
  3263.  
  3264.  
  3265. PROCEDURE SelectMode;
  3266. VAR
  3267.     choice1,choice2     : CHAR;
  3268.    xsize,ysize            : WORD;
  3269. BEGIN
  3270.     (* Let's select a mode *)
  3271.     ClrScr;
  3272.     WriteLn('VESADEMO:');
  3273.     WriteLn('1. 256 colors');
  3274.     WriteLn('2. 32768 colors');
  3275.     WriteLn('3. 65536 colors');
  3276.     WriteLn('4. 16777216 colors');
  3277.     WriteLn('Q uit');
  3278.     WriteLn;
  3279.     Write('Your choice: ');
  3280.     REPEAT
  3281.         ReadLn(choice1);
  3282.       IF choice1 <> '1' THEN BEGIN
  3283.           WriteLn('Sorry !');
  3284.          WriteLn('This demo wasn''t written for more as 256 colors !');
  3285.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  3286.          WriteLn('Switching to 256 colors.');
  3287.          choice1 := '1';
  3288.       END;
  3289.     UNTIL choice1 IN ['1'..'4','q'];
  3290.     IF choice1 = 'q' THEN Halt;
  3291.  
  3292.     WriteLn;
  3293.     WriteLn;
  3294.     WriteLn('a. 320x200');
  3295.     WriteLn('b. 640x480');
  3296.     WriteLn('c. 800x600');
  3297.     WriteLn('d. 1024x768');
  3298.     WriteLn('e. 1280x1024');
  3299.     WriteLn('Q uit');
  3300.     WriteLn;
  3301.     Write('Your choice: ');
  3302.     REPEAT
  3303.         ReadLn(choice2);
  3304.     UNTIL choice2 IN ['a'..'e','q'];
  3305.     IF choice2 = 'q' THEN Halt;
  3306.  
  3307.     CASE choice2 OF
  3308.         'a' : BEGIN
  3309.             xsize := 320;
  3310.             ysize := 200;
  3311.         END;
  3312.         'b' : BEGIN
  3313.             xsize := 640;
  3314.             ysize := 480;
  3315.         END;
  3316.         'c' : BEGIN
  3317.             xsize := 800;
  3318.             ysize := 600;
  3319.         END;
  3320.         'd' : BEGIN
  3321.             xsize := 1024;
  3322.             ysize := 768;
  3323.         END;
  3324.         'e' : BEGIN
  3325.             xsize := 1280;
  3326.             ysize := 1024;
  3327.         END;
  3328.     END;
  3329.     CASE choice1 OF
  3330.         '1' : mode := FindVesaMode(xsize,ysize,8);
  3331.         '2' : mode := FindVesaMode(xsize,ysize,15);
  3332.         '3' : mode := FindVesaMode(xsize,ysize,16);
  3333.         '4' : mode := FindVesaMode(xsize,ysize,24);
  3334.     END;
  3335.     IF mode = 0 THEN BEGIN
  3336.         WriteLn('No such mode could be found !');
  3337.         WriteLn('Switching to to 320x200.');
  3338.         ReadKey;
  3339.         mode := V320x200x256;
  3340.     END;
  3341. END;
  3342.  
  3343. begin { program body }
  3344.   SelectMode;
  3345.   Initialize;
  3346.   ReportStatus;
  3347.  
  3348. {  AspectRatioPlay; }
  3349.   FillEllipsePlay;
  3350.   SectorPlay;
  3351.   WriteModePlay;
  3352.  
  3353.   ColorPlay;
  3354.   { PalettePlay only intended to work on these drivers: }
  3355.   if (GraphDriver = EGA) or
  3356.       (GraphDriver = EGA64) or
  3357.       (GraphDriver = VGA) then
  3358.      PalettePlay;
  3359.   PutPixelPlay;
  3360. {  PutImagePlay; }
  3361.   RandBarPlay;
  3362.   BarPlay;
  3363.   Bar3DPlay;
  3364.   ArcPlay;
  3365.   CirclePlay;
  3366.   PiePlay;
  3367.   LineToPlay;
  3368.   LineRelPlay;
  3369. {  LineStylePlay; }
  3370. {  UserLineStylePlay; }
  3371.   TextDump;
  3372.   TextPlay;
  3373.   CrtModePlay;
  3374.   FillStylePlay;
  3375.   FillPatternPlay;
  3376.   PolyPlay;
  3377.   SayGoodbye;
  3378. {  CloseGraph; }
  3379.   CloseVesa;
  3380. end.
  3381. ***************************************************
  3382.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  3383.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  3384. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  3385. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  3386. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  3387. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  3388.     Color := RandColor;
  3389.     SetColor(Color);
  3390.     SetFillStyle(Random(CloseDotFill)+1, Color);
  3391.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  3392.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  3393.   until KeyPressed;
  3394.   WaitToGo;
  3395. end; { RandBarPlay }
  3396.  
  3397. procedure ArcPlay;
  3398. { Draw random arcs on the screen }
  3399. var
  3400.   MaxRadius : word;
  3401.   EndAngle : word;
  3402.   ArcInfo : ArcCoordsType;
  3403. begin
  3404.   MainWindow('Arc / GetArcCoords demonstration');
  3405.   StatusLine('Esc aborts or press a key');
  3406.   MaxRadius := MaxY div 10;
  3407.   repeat
  3408.     SetColor(RandColor);
  3409.     EndAngle := Random(360);
  3410.     SetLineStyle(SolidLn, 0, NormWidth);
  3411.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  3412.     GetArcCoords(ArcInfo);
  3413.     with ArcInfo do
  3414.     begin
  3415.       Line(X, Y, XStart, YStart);
  3416.       Line(X, Y, Xend, Yend);
  3417.     end;
  3418.   until KeyPressed;
  3419.   WaitToGo;
  3420. end; { ArcPlay }
  3421.  
  3422. procedure PutPixelPlay;
  3423. { Demonstrate the PutPixel and GetPixel commands }
  3424. const
  3425.   Seed   = 1962; { A seed for the random number generator }
  3426.   NumPts = 2000; { The number of pixels plotted }
  3427.   Esc    = #27;
  3428. var
  3429.   I : word;
  3430.   X, Y, Color : word;
  3431.   XMax, YMax  : integer;
  3432.   ViewInfo    : ViewPortType;
  3433. begin
  3434.   MainWindow('PutPixel / GetPixel demonstration');
  3435.   StatusLine('Esc aborts or press a key...');
  3436.  
  3437.   GetViewSettings(ViewInfo);
  3438.   with ViewInfo do
  3439.   begin
  3440.     XMax := (x2-x1-1);
  3441.     YMax := (y2-y1-1);
  3442.   end;
  3443.  
  3444.   while not KeyPressed do
  3445.   begin
  3446.     { Plot random pixels }
  3447.     RandSeed := Seed;
  3448.     I := 0;
  3449.     while (not KeyPressed) and (I < NumPts) do
  3450.     begin
  3451.       Inc(I);
  3452.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  3453.     end;
  3454.  
  3455.     { Erase pixels }
  3456.     RandSeed := Seed;
  3457.     I := 0;
  3458.     while (not KeyPressed) and (I < NumPts) do
  3459.     begin
  3460.       Inc(I);
  3461.       X := Random(XMax)+1;
  3462.       Y := Random(YMax)+1;
  3463.       Color := GetPixel(X, Y);
  3464.         if Color = RandColor then
  3465.           PutPixel(X, Y, 0);
  3466.      end;
  3467.   end;
  3468.   WaitToGo;
  3469. end; { PutPixelPlay }
  3470.  
  3471. procedure PutImagePlay;
  3472. { Demonstrate the GetImage and PutImage commands }
  3473.  
  3474. const
  3475.   r  = 20;
  3476.   StartX = 100;
  3477.   StartY = 50;
  3478.  
  3479. var
  3480.   CurPort : ViewPortType;
  3481.  
  3482. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  3483. var
  3484.   Step : integer;
  3485. begin
  3486.   Step := Random(2*r);
  3487.   if Odd(Step) then
  3488.     Step := -Step;
  3489.   X := X + Step;
  3490.   Step := Random(r);
  3491.   if Odd(Step) then
  3492.     Step := -Step;
  3493.   Y := Y + Step;
  3494.  
  3495.   { Make saucer bounce off viewport walls }
  3496.   with CurPort do
  3497.   begin
  3498.     if (x1 + X + Width - 1 > x2) then
  3499.       X := x2-x1 - Width + 1
  3500.     else
  3501.       if (X < 0) then
  3502.         X := 0;
  3503.     if (y1 + Y + Height - 1 > y2) then
  3504.       Y := y2-y1 - Height + 1
  3505.     else
  3506.       if (Y < 0) then
  3507.         Y := 0;
  3508.   end;
  3509. end; { MoveSaucer }
  3510.  
  3511. var
  3512.   Pausetime : word;
  3513.   Saucer    : pointer;
  3514.   X, Y      : integer;
  3515.   ulx, uly  : word;
  3516.   lrx, lry  : word;
  3517.   Size      : word;
  3518.   I         : word;
  3519. begin
  3520.   ClearDevice;
  3521.   FullPort;
  3522.  
  3523.   { PaintScreen }
  3524.   ClearDevice;
  3525.   MainWindow('GetImage / PutImage Demonstration');
  3526.   StatusLine('Esc aborts or press a key...');
  3527.   GetViewSettings(CurPort);
  3528.  
  3529.   { DrawSaucer }
  3530.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  3531.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  3532.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  3533.   Circle(StartX+10, StartY-12, 2);
  3534.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  3535.   Circle(StartX-10, StartY-12, 2);
  3536.   SetFillStyle(SolidFill, MaxColor);
  3537.   FloodFill(StartX+1, StartY+4, GetColor);
  3538.  
  3539.   { ReadSaucerImage }
  3540.   ulx := StartX-(r+1);
  3541.   uly := StartY-14;
  3542.   lrx := StartX+(r+1);
  3543.   lry := StartY+(r div 3)+3;
  3544.  
  3545.   Size := ImageSize(ulx, uly, lrx, lry);
  3546.   GetMem(Saucer, Size);
  3547.   GetImage(ulx, uly, lrx, lry, Saucer^);
  3548. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  3549.  
  3550.   { Plot some "stars" }
  3551.   for I := 1 to 1000 do
  3552.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  3553.   X := MaxX div 2;
  3554.   Y := MaxY div 2;
  3555.   PauseTime := 70;
  3556.  
  3557.   { Move the saucer around }
  3558.   repeat
  3559. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  3560.      Delay(PauseTime);
  3561. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  3562.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  3563.   until KeyPressed;
  3564.   FreeMem(Saucer, size);
  3565.   WaitToGo;
  3566. end; { PutImagePlay }
  3567.  
  3568. procedure PolyPlay;
  3569. { Draw random polygons with random fill styles on the screen }
  3570. const
  3571.   MaxPts = 5;
  3572. type
  3573.   PolygonType = array[1..MaxPts] of PointType;
  3574. var
  3575.   Poly : PolygonType;
  3576.   I, Color : word;
  3577. begin
  3578.   MainWindow('FillPoly demonstration');
  3579.   StatusLine('Esc aborts or press a key...');
  3580.   repeat
  3581.     Color := RandColor;
  3582.     SetFillStyle(Random(11)+1, Color);
  3583.     SetColor(Color);
  3584.     for I := 1 to MaxPts do
  3585.       with Poly[I] do
  3586.       begin
  3587.         X := Random(MaxX);
  3588.         Y := Random(MaxY);
  3589.       end;
  3590.     FillPoly(MaxPts, Poly);
  3591.   until KeyPressed;
  3592.   WaitToGo;
  3593. end; { PolyPlay }
  3594.  
  3595. procedure FillStylePlay;
  3596. { Display all of the predefined fill styles available }
  3597. var
  3598.   Style    : word;
  3599.   Width    : word;
  3600.   Height   : word;
  3601.   X, Y     : word;
  3602.   I, J     : word;
  3603.   ViewInfo : ViewPortType;
  3604.  
  3605. procedure DrawBox(X, Y : word);
  3606. begin
  3607.   SetFillStyle(Style, MaxColor);
  3608.   with ViewInfo do
  3609.     Bar(X, Y, X+Width, Y+Height);
  3610.   Rectangle(X, Y, X+Width, Y+Height);
  3611.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  3612.   Inc(Style);
  3613. end; { DrawBox }
  3614.  
  3615. begin
  3616.   MainWindow('Pre-defined fill styles');
  3617.   GetViewSettings(ViewInfo);
  3618.   with ViewInfo do
  3619.   begin
  3620.     Width := 2 * ((x2+1) div 13);
  3621.     Height := 2 * ((y2-10) div 10);
  3622.   end;
  3623.   X := Width div 2;
  3624.   Y := Height div 2;
  3625.   Style := 0;
  3626.   for J := 1 to 3 do
  3627.   begin
  3628.     for I := 1 to 4 do
  3629.     begin
  3630.       DrawBox(X, Y);
  3631.       Inc(X, (Width div 2) * 3);
  3632.     end;
  3633.     X := Width div 2;
  3634.     Inc(Y, (Height div 2) * 3);
  3635.   end;
  3636.   SetTextJustify(LeftText, TopText);
  3637.   WaitToGo;
  3638. end; { FillStylePlay }
  3639.  
  3640. procedure FillPatternPlay;
  3641. { Display some user defined fill patterns }
  3642. const
  3643.   Patterns : array[0..11] of FillPatternType = (
  3644.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  3645.             OldColor which has a path of pixels of OldColor or NewColor
  3646.             with sides touching back to the seed point, (XSeed, YSeed).
  3647.             Therefore, only pixels of OldColor are modified and no other
  3648.             information is changed.
  3649.  
  3650.             SEE ALSO
  3651.  
  3652.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3653.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  3654.             SETVIEW
  3655.  
  3656.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  3657.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  3658.             IF WHICHVGA = 0 THEN STOP
  3659.             DUMMY=RES640
  3660.             SETVIEW 100, 100, 539, 379
  3661.             FILLVIEW 10
  3662.             WHILE INKEY$ = ""
  3663.             WEND
  3664.             VIDEOMODESET VMODE
  3665.             END
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.                                                                          63
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.           FONTGETINFO
  3690.  
  3691.             PROTOTYPE
  3692.  
  3693.             SUB FONTGETINFO (Width%, Height%)
  3694.  
  3695.             INPUT
  3696.  
  3697.             no input parameters
  3698.     WEND
  3699.             MOUSEEXIT
  3700.             VIDEOMODESET VMODE
  3701.             END
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721.  
  3722.  
  3723.  
  3724.  
  3725.  
  3726.  
  3727.  
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.                                                                          86
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.           MOUSECURSORDEFAULT
  3750.  
  3751.             PROTOTYPE
  3752.  
  3753.             SUB MOUSECURSORDEFAULT ()
  3754.  
  3755.             INPUT
  3756.  
  3757.             no input parameters
  3758.  
  3759.             OUTPUT
  3760.  
  3761.             no value returned
  3762.  
  3763.             USAGE
  3764.  
  3765.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  3766.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  3767. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  3768. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  3769. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  3770. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  3771. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  3772. $╤
  3773. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  3774. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  3775. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  3776. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  3777. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  3778. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  3779. ░£▒
  3780. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  3781. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  3782.       end;
  3783.     end;
  3784.   end;
  3785.   WaitToGo;
  3786. end; { UserLineStylePlay }
  3787.  
  3788.  
  3789. procedure SayGoodbye;
  3790. { Say goodbye and then exit the program }
  3791. var
  3792.   ViewInfo : ViewPortType;
  3793. begin
  3794.   MainWindow('');
  3795.   GetViewSettings(ViewInfo);
  3796.   SetTextStyle(TriplexFont, HorizDir, 4);
  3797.   SetTextJustify(CenterText, CenterText);
  3798.   with ViewInfo do
  3799.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  3800.   StatusLine('Press any key to quit...');
  3801.   repeat until KeyPressed;
  3802. end; { SayGoodbye }
  3803.  
  3804.  
  3805. PROCEDURE SelectMode;
  3806. VAR
  3807.     choice1,choice2     : CHAR;
  3808.    xsize,ysize            : WORD;
  3809. BEGIN
  3810.     (* Let's select a mode *)
  3811.     ClrScr;
  3812.     WriteLn('VESADEMO:');
  3813.     WriteLn('1. 256 colors');
  3814.     WriteLn('2. 32768 colors');
  3815.     WriteLn('3. 65536 colors');
  3816.     WriteLn('4. 16777216 colors');
  3817.     WriteLn('Q uit');
  3818.     WriteLn;
  3819.     Write('Your choice: ');
  3820.     REPEAT
  3821.         ReadLn(choice1);
  3822.       IF choice1 <> '1' THEN BEGIN
  3823.           WriteLn('Sorry !');
  3824.          WriteLn('This demo wasn''t written for more as 256 colors !');
  3825.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  3826.          WriteLn('Switching to 256 colors.');
  3827.          choice1 := '1';
  3828.       END;
  3829.     UNTIL choice1 IN ['1'..'4','q'];
  3830.     IF choice1 = 'q' THEN Halt;
  3831.  
  3832.     WriteLn;
  3833.     WriteLn;
  3834.     WriteLn('a. 320x200');
  3835.     WriteLn('b. 640x480');
  3836.     WriteLn('c. 800x600');
  3837.     WriteLn('d. 1024x768');
  3838.     WriteLn('e. 1280x1024');
  3839.     WriteLn('Q uit');
  3840.     WriteLn;
  3841.     Write('Your choice: ');
  3842.     REPEAT
  3843.         ReadLn(choice2);
  3844.     UNTIL choice2 IN ['a'..'e','q'];
  3845.     IF choice2 = 'q' THEN Halt;
  3846.  
  3847.     CASE choice2 OF
  3848.         'a' : BEGIN
  3849.             xsize := 320;
  3850.             ysize := 200;
  3851.         END;
  3852.         'b' : BEGIN
  3853.             xsize := 640;
  3854.             ysize := 480;
  3855.         END;
  3856.         'c' : BEGIN
  3857.             xsize := 800;
  3858.             ysize := 600;
  3859.         END;
  3860.         'd' : BEGIN
  3861.             xsize := 1024;
  3862.             ysize := 768;
  3863.         END;
  3864.         'e' : BEGIN
  3865.             xsize := 1280;
  3866.             ysize := 1024;
  3867.         END;
  3868.     END;
  3869.     CASE choice1 OF
  3870.         '1' : mode := FindVesaMode(xsize,ysize,8);
  3871.         '2' : mode := FindVesaMode(xsize,ysize,15);
  3872.         '3' : mode := FindVesaMode(xsize,ysize,16);
  3873.         '4' : mode := FindVesaMode(xsize,ysize,24);
  3874.     END;
  3875.     IF mode = 0 THEN BEGIN
  3876.         WriteLn('No such mode could be found !');
  3877.         WriteLn('Switching to to 320x200.');
  3878.         ReadKey;
  3879.         mode := V320x200x256;
  3880.     END;
  3881. END;
  3882.  
  3883. begin { program body }
  3884.   SelectMode;
  3885.   Initialize;
  3886.   ReportStatus;
  3887.  
  3888. {  AspectRatioPlay; }
  3889.   FillEllipsePlay;
  3890.   SectorPlay;
  3891.   WriteModePlay;
  3892.  
  3893.   ColorPlay;
  3894.   { PalettePlay only intended to work on these drivers: }
  3895.   if (GraphDriver = EGA) or
  3896.       (GraphDriver = EGA64) or
  3897.       (GraphDriver = VGA) then
  3898.      PalettePlay;
  3899.   PutPixelPlay;
  3900. {  PutImagePlay; }
  3901.   RandBarPlay;
  3902.   BarPlay;
  3903.   Bar3DPlay;
  3904.   ArcPlay;
  3905.   CirclePlay;
  3906.   PiePlay;
  3907.   LineToPlay;
  3908.   LineRelPlay;
  3909. {  LineStylePlay; }
  3910. {  UserLineStylePlay; }
  3911.   TextDump;
  3912.   TextPlay;
  3913.   CrtModePlay;
  3914.   FillStylePlay;
  3915.   FillPatternPlay;
  3916.   PolyPlay;
  3917.   SayGoodbye;
  3918. {  CloseGraph; }
  3919.   CloseVesa;
  3920. end.
  3921. ***************************************************
  3922.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  3923.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  3924. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  3925. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  3926. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  3927. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  3928.     Color := RandColor;
  3929.     SetColor(Color);
  3930.     SetFillStyle(Random(CloseDotFill)+1, Color);
  3931.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  3932.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  3933.   until KeyPressed;
  3934.   WaitToGo;
  3935. end; { RandBarPlay }
  3936.  
  3937. procedure ArcPlay;
  3938. { Draw random arcs on the screen }
  3939. var
  3940.   MaxRadius : word;
  3941.   EndAngle : word;
  3942.   ArcInfo : ArcCoordsType;
  3943. begin
  3944.   MainWindow('Arc / GetArcCoords demonstration');
  3945.   StatusLine('Esc aborts or press a key');
  3946.   MaxRadius := MaxY div 10;
  3947.   repeat
  3948.     SetColor(RandColor);
  3949.     EndAngle := Random(360);
  3950.     SetLineStyle(SolidLn, 0, NormWidth);
  3951.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  3952.     GetArcCoords(ArcInfo);
  3953.     with ArcInfo do
  3954.     begin
  3955.       Line(X, Y, XStart, YStart);
  3956.       Line(X, Y, Xend, Yend);
  3957.     end;
  3958.   until KeyPressed;
  3959.   WaitToGo;
  3960. end; { ArcPlay }
  3961.  
  3962. procedure PutPixelPlay;
  3963. { Demonstrate the PutPixel and GetPixel commands }
  3964. const
  3965.   Seed   = 1962; { A seed for the random number generator }
  3966.   NumPts = 2000; { The number of pixels plotted }
  3967.   Esc    = #27;
  3968. var
  3969.   I : word;
  3970.   X, Y, Color : word;
  3971.   XMax, YMax  : integer;
  3972.   ViewInfo    : ViewPortType;
  3973. begin
  3974.   MainWindow('PutPixel / GetPixel demonstration');
  3975.   StatusLine('Esc aborts or press a key...');
  3976.  
  3977.   GetViewSettings(ViewInfo);
  3978.   with ViewInfo do
  3979.   begin
  3980.     XMax := (x2-x1-1);
  3981.     YMax := (y2-y1-1);
  3982.   end;
  3983.  
  3984.   while not KeyPressed do
  3985.   begin
  3986.     { Plot random pixels }
  3987.     RandSeed := Seed;
  3988.     I := 0;
  3989.     while (not KeyPressed) and (I < NumPts) do
  3990.     begin
  3991.       Inc(I);
  3992.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  3993.     end;
  3994.  
  3995.     { Erase pixels }
  3996.     RandSeed := Seed;
  3997.     I := 0;
  3998.     while (not KeyPressed) and (I < NumPts) do
  3999.     begin
  4000.       Inc(I);
  4001.       X := Random(XMax)+1;
  4002.       Y := Random(YMax)+1;
  4003.       Color := GetPixel(X, Y);
  4004.         if Color = RandColor then
  4005.           PutPixel(X, Y, 0);
  4006.      end;
  4007.   end;
  4008.   WaitToGo;
  4009. end; { PutPixelPlay }
  4010.  
  4011. procedure PutImagePlay;
  4012. { Demonstrate the GetImage and PutImage commands }
  4013.  
  4014. const
  4015.   r  = 20;
  4016.   StartX = 100;
  4017.   StartY = 50;
  4018.  
  4019. var
  4020.   CurPort : ViewPortType;
  4021.  
  4022. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  4023. var
  4024.   Step : integer;
  4025. begin
  4026.   Step := Random(2*r);
  4027.   if Odd(Step) then
  4028.     Step := -Step;
  4029.   X := X + Step;
  4030.   Step := Random(r);
  4031.   if Odd(Step) then
  4032.     Step := -Step;
  4033.   Y := Y + Step;
  4034.  
  4035.   { Make saucer bounce off viewport walls }
  4036.   with CurPort do
  4037.   begin
  4038.     if (x1 + X + Width - 1 > x2) then
  4039.       X := x2-x1 - Width + 1
  4040.     else
  4041.       if (X < 0) then
  4042.         X := 0;
  4043.     if (y1 + Y + Height - 1 > y2) then
  4044.       Y := y2-y1 - Height + 1
  4045.     else
  4046.       if (Y < 0) then
  4047.         Y := 0;
  4048.   end;
  4049. end; { MoveSaucer }
  4050.  
  4051. var
  4052.   Pausetime : word;
  4053.   Saucer    : pointer;
  4054.   X, Y      : integer;
  4055.   ulx, uly  : word;
  4056.   lrx, lry  : word;
  4057.   Size      : word;
  4058.   I         : word;
  4059. begin
  4060.   ClearDevice;
  4061.   FullPort;
  4062.  
  4063.   { PaintScreen }
  4064.   ClearDevice;
  4065.   MainWindow('GetImage / PutImage Demonstration');
  4066.   StatusLine('Esc aborts or press a key...');
  4067.   GetViewSettings(CurPort);
  4068.  
  4069.   { DrawSaucer }
  4070.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  4071.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  4072.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  4073.   Circle(StartX+10, StartY-12, 2);
  4074.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  4075.   Circle(StartX-10, StartY-12, 2);
  4076.   SetFillStyle(SolidFill, MaxColor);
  4077.   FloodFill(StartX+1, StartY+4, GetColor);
  4078.  
  4079.   { ReadSaucerImage }
  4080.   ulx := StartX-(r+1);
  4081.   uly := StartY-14;
  4082.   lrx := StartX+(r+1);
  4083.   lry := StartY+(r div 3)+3;
  4084.  
  4085.   Size := ImageSize(ulx, uly, lrx, lry);
  4086.   GetMem(Saucer, Size);
  4087.   GetImage(ulx, uly, lrx, lry, Saucer^);
  4088. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  4089.  
  4090.   { Plot some "stars" }
  4091.   for I := 1 to 1000 do
  4092.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  4093.   X := MaxX div 2;
  4094.   Y := MaxY div 2;
  4095.   PauseTime := 70;
  4096.  
  4097.   { Move the saucer around }
  4098.   repeat
  4099. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  4100.      Delay(PauseTime);
  4101. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  4102.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  4103.   until KeyPressed;
  4104.   FreeMem(Saucer, size);
  4105.   WaitToGo;
  4106. end; { PutImagePlay }
  4107.  
  4108. procedure PolyPlay;
  4109. { Draw random polygons with random fill styles on the screen }
  4110. const
  4111.   MaxPts = 5;
  4112. type
  4113.   PolygonType = array[1..MaxPts] of PointType;
  4114. var
  4115.   Poly : PolygonType;
  4116.   I, Color : word;
  4117. begin
  4118.   MainWindow('FillPoly demonstration');
  4119.   StatusLine('Esc aborts or press a key...');
  4120.   repeat
  4121.     Color := RandColor;
  4122.     SetFillStyle(Random(11)+1, Color);
  4123.     SetColor(Color);
  4124.     for I := 1 to MaxPts do
  4125.       with Poly[I] do
  4126.       begin
  4127.         X := Random(MaxX);
  4128.         Y := Random(MaxY);
  4129.       end;
  4130.     FillPoly(MaxPts, Poly);
  4131.   until KeyPressed;
  4132.   WaitToGo;
  4133. end; { PolyPlay }
  4134.  
  4135. procedure FillStylePlay;
  4136. { Display all of the predefined fill styles available }
  4137. var
  4138.   Style    : word;
  4139.   Width    : word;
  4140.   Height   : word;
  4141.   X, Y     : word;
  4142.   I, J     : word;
  4143.   ViewInfo : ViewPortType;
  4144.  
  4145. procedure DrawBox(X, Y : word);
  4146. begin
  4147.   SetFillStyle(Style, MaxColor);
  4148.   with ViewInfo do
  4149.     Bar(X, Y, X+Width, Y+Height);
  4150.   Rectangle(X, Y, X+Width, Y+Height);
  4151.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  4152.   Inc(Style);
  4153. end; { DrawBox }
  4154.  
  4155. begin
  4156.   MainWindow('Pre-defined fill styles');
  4157.   GetViewSettings(ViewInfo);
  4158.   with ViewInfo do
  4159.   begin
  4160.     Width := 2 * ((x2+1) div 13);
  4161.     Height := 2 * ((y2-10) div 10);
  4162.   end;
  4163.   X := Width div 2;
  4164.   Y := Height div 2;
  4165.   Style := 0;
  4166.   for J := 1 to 3 do
  4167.   begin
  4168.     for I := 1 to 4 do
  4169.     begin
  4170.       DrawBox(X, Y);
  4171.       Inc(X, (Width div 2) * 3);
  4172.     end;
  4173.     X := Width div 2;
  4174.     Inc(Y, (Height div 2) * 3);
  4175.   end;
  4176.   SetTextJustify(LeftText, TopText);
  4177.   WaitToGo;
  4178. end; { FillStylePlay }
  4179.  
  4180. procedure FillPatternPlay;
  4181. { Display some user defined fill patterns }
  4182. const
  4183.   Patterns : array[0..11] of FillPatternType = (
  4184.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  4185.             OldColor which has a path of pixels of OldColor or NewColor
  4186.             with sides touching back to the seed point, (XSeed, YSeed).
  4187.             Therefore, only pixels of OldColor are modified and no other
  4188.             information is changed.
  4189.  
  4190.             SEE ALSO
  4191.  
  4192.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4193.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  4194.             SETVIEW
  4195.  
  4196.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  4197.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  4198.             IF WHICHVGA = 0 THEN STOP
  4199.             DUMMY=RES640
  4200.             SETVIEW 100, 100, 539, 379
  4201.             FILLVIEW 10
  4202.             WHILE INKEY$ = ""
  4203.             WEND
  4204.             VIDEOMODESET VMODE
  4205.             END
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.                                                                          63
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.           FONTGETINFO
  4230.  
  4231.             PROTOTYPE
  4232.  
  4233.             SUB FONTGETINFO (Width%, Height%)
  4234.  
  4235.             INPUT
  4236.  
  4237.             no input parameters
  4238.     WEND
  4239.             MOUSEEXIT
  4240.             VIDEOMODESET VMODE
  4241.             END
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.                                                                          86
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.           MOUSECURSORDEFAULT
  4290.  
  4291.             PROTOTYPE
  4292.  
  4293.             SUB MOUSECURSORDEFAULT ()
  4294.  
  4295.             INPUT
  4296.  
  4297.             no input parameters
  4298.  
  4299.             OUTPUT
  4300.  
  4301.             no value returned
  4302.  
  4303.             USAGE
  4304.  
  4305.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  4306.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  4307. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  4308. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  4309. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  4310. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  4311. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  4312. $╤
  4313. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  4314. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  4315. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  4316. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  4317. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  4318. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  4319. ░£▒
  4320. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  4321. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  4322.       end;
  4323.     end;
  4324.   end;
  4325.   WaitToGo;
  4326. end; { UserLineStylePlay }
  4327.  
  4328.  
  4329. procedure SayGoodbye;
  4330. { Say goodbye and then exit the program }
  4331. var
  4332.   ViewInfo : ViewPortType;
  4333. begin
  4334.   MainWindow('');
  4335.   GetViewSettings(ViewInfo);
  4336.   SetTextStyle(TriplexFont, HorizDir, 4);
  4337.   SetTextJustify(CenterText, CenterText);
  4338.   with ViewInfo do
  4339.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  4340.   StatusLine('Press any key to quit...');
  4341.   repeat until KeyPressed;
  4342. end; { SayGoodbye }
  4343.  
  4344.  
  4345. PROCEDURE SelectMode;
  4346. VAR
  4347.     choice1,choice2     : CHAR;
  4348.    xsize,ysize            : WORD;
  4349. BEGIN
  4350.     (* Let's select a mode *)
  4351.     ClrScr;
  4352.     WriteLn('VESADEMO:');
  4353.     WriteLn('1. 256 colors');
  4354.     WriteLn('2. 32768 colors');
  4355.     WriteLn('3. 65536 colors');
  4356.     WriteLn('4. 16777216 colors');
  4357.     WriteLn('Q uit');
  4358.     WriteLn;
  4359.     Write('Your choice: ');
  4360.     REPEAT
  4361.         ReadLn(choice1);
  4362.       IF choice1 <> '1' THEN BEGIN
  4363.           WriteLn('Sorry !');
  4364.          WriteLn('This demo wasn''t written for more as 256 colors !');
  4365.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  4366.          WriteLn('Switching to 256 colors.');
  4367.          choice1 := '1';
  4368.       END;
  4369.     UNTIL choice1 IN ['1'..'4','q'];
  4370.     IF choice1 = 'q' THEN Halt;
  4371.  
  4372.     WriteLn;
  4373.     WriteLn;
  4374.     WriteLn('a. 320x200');
  4375.     WriteLn('b. 640x480');
  4376.     WriteLn('c. 800x600');
  4377.     WriteLn('d. 1024x768');
  4378.     WriteLn('e. 1280x1024');
  4379.     WriteLn('Q uit');
  4380.     WriteLn;
  4381.     Write('Your choice: ');
  4382.     REPEAT
  4383.         ReadLn(choice2);
  4384.     UNTIL choice2 IN ['a'..'e','q'];
  4385.     IF choice2 = 'q' THEN Halt;
  4386.  
  4387.     CASE choice2 OF
  4388.         'a' : BEGIN
  4389.             xsize := 320;
  4390.             ysize := 200;
  4391.         END;
  4392.         'b' : BEGIN
  4393.             xsize := 640;
  4394.             ysize := 480;
  4395.         END;
  4396.         'c' : BEGIN
  4397.             xsize := 800;
  4398.             ysize := 600;
  4399.         END;
  4400.         'd' : BEGIN
  4401.             xsize := 1024;
  4402.             ysize := 768;
  4403.         END;
  4404.         'e' : BEGIN
  4405.             xsize := 1280;
  4406.             ysize := 1024;
  4407.         END;
  4408.     END;
  4409.     CASE choice1 OF
  4410.         '1' : mode := FindVesaMode(xsize,ysize,8);
  4411.         '2' : mode := FindVesaMode(xsize,ysize,15);
  4412.         '3' : mode := FindVesaMode(xsize,ysize,16);
  4413.         '4' : mode := FindVesaMode(xsize,ysize,24);
  4414.     END;
  4415.     IF mode = 0 THEN BEGIN
  4416.         WriteLn('No such mode could be found !');
  4417.         WriteLn('Switching to to 320x200.');
  4418.         ReadKey;
  4419.         mode := V320x200x256;
  4420.     END;
  4421. END;
  4422.  
  4423. begin { program body }
  4424.   SelectMode;
  4425.   Initialize;
  4426.   ReportStatus;
  4427.  
  4428. {  AspectRatioPlay; }
  4429.   FillEllipsePlay;
  4430.   SectorPlay;
  4431.   WriteModePlay;
  4432.  
  4433.   ColorPlay;
  4434.   { PalettePlay only intended to work on these drivers: }
  4435.   if (GraphDriver = EGA) or
  4436.       (GraphDriver = EGA64) or
  4437.       (GraphDriver = VGA) then
  4438.      PalettePlay;
  4439.   PutPixelPlay;
  4440. {  PutImagePlay; }
  4441.   RandBarPlay;
  4442.   BarPlay;
  4443.   Bar3DPlay;
  4444.   ArcPlay;
  4445.   CirclePlay;
  4446.   PiePlay;
  4447.   LineToPlay;
  4448.   LineRelPlay;
  4449. {  LineStylePlay; }
  4450. {  UserLineStylePlay; }
  4451.   TextDump;
  4452.   TextPlay;
  4453.   CrtModePlay;
  4454.   FillStylePlay;
  4455.   FillPatternPlay;
  4456.   PolyPlay;
  4457.   SayGoodbye;
  4458. {  CloseGraph; }
  4459.   CloseVesa;
  4460. end.
  4461. ***************************************************
  4462.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  4463.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  4464. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  4465. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  4466. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  4467. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  4468.     Color := RandColor;
  4469.     SetColor(Color);
  4470.     SetFillStyle(Random(CloseDotFill)+1, Color);
  4471.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  4472.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  4473.   until KeyPressed;
  4474.   WaitToGo;
  4475. end; { RandBarPlay }
  4476.  
  4477. procedure ArcPlay;
  4478. { Draw random arcs on the screen }
  4479. var
  4480.   MaxRadius : word;
  4481.   EndAngle : word;
  4482.   ArcInfo : ArcCoordsType;
  4483. begin
  4484.   MainWindow('Arc / GetArcCoords demonstration');
  4485.   StatusLine('Esc aborts or press a key');
  4486.   MaxRadius := MaxY div 10;
  4487.   repeat
  4488.     SetColor(RandColor);
  4489.     EndAngle := Random(360);
  4490.     SetLineStyle(SolidLn, 0, NormWidth);
  4491.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  4492.     GetArcCoords(ArcInfo);
  4493.     with ArcInfo do
  4494.     begin
  4495.       Line(X, Y, XStart, YStart);
  4496.       Line(X, Y, Xend, Yend);
  4497.     end;
  4498.   until KeyPressed;
  4499.   WaitToGo;
  4500. end; { ArcPlay }
  4501.  
  4502. procedure PutPixelPlay;
  4503. { Demonstrate the PutPixel and GetPixel commands }
  4504. const
  4505.   Seed   = 1962; { A seed for the random number generator }
  4506.   NumPts = 2000; { The number of pixels plotted }
  4507.   Esc    = #27;
  4508. var
  4509.   I : word;
  4510.   X, Y, Color : word;
  4511.   XMax, YMax  : integer;
  4512.   ViewInfo    : ViewPortType;
  4513. begin
  4514.   MainWindow('PutPixel / GetPixel demonstration');
  4515.   StatusLine('Esc aborts or press a key...');
  4516.  
  4517.   GetViewSettings(ViewInfo);
  4518.   with ViewInfo do
  4519.   begin
  4520.     XMax := (x2-x1-1);
  4521.     YMax := (y2-y1-1);
  4522.   end;
  4523.  
  4524.   while not KeyPressed do
  4525.   begin
  4526.     { Plot random pixels }
  4527.     RandSeed := Seed;
  4528.     I := 0;
  4529.     while (not KeyPressed) and (I < NumPts) do
  4530.     begin
  4531.       Inc(I);
  4532.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  4533.     end;
  4534.  
  4535.     { Erase pixels }
  4536.     RandSeed := Seed;
  4537.     I := 0;
  4538.     while (not KeyPressed) and (I < NumPts) do
  4539.     begin
  4540.       Inc(I);
  4541.       X := Random(XMax)+1;
  4542.       Y := Random(YMax)+1;
  4543.       Color := GetPixel(X, Y);
  4544.         if Color = RandColor then
  4545.           PutPixel(X, Y, 0);
  4546.      end;
  4547.   end;
  4548.   WaitToGo;
  4549. end; { PutPixelPlay }
  4550.  
  4551. procedure PutImagePlay;
  4552. { Demonstrate the GetImage and PutImage commands }
  4553.  
  4554. const
  4555.   r  = 20;
  4556.   StartX = 100;
  4557.   StartY = 50;
  4558.  
  4559. var
  4560.   CurPort : ViewPortType;
  4561.  
  4562. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  4563. var
  4564.   Step : integer;
  4565. begin
  4566.   Step := Random(2*r);
  4567.   if Odd(Step) then
  4568.     Step := -Step;
  4569.   X := X + Step;
  4570.   Step := Random(r);
  4571.   if Odd(Step) then
  4572.     Step := -Step;
  4573.   Y := Y + Step;
  4574.  
  4575.   { Make saucer bounce off viewport walls }
  4576.   with CurPort do
  4577.   begin
  4578.     if (x1 + X + Width - 1 > x2) then
  4579.       X := x2-x1 - Width + 1
  4580.     else
  4581.       if (X < 0) then
  4582.         X := 0;
  4583.     if (y1 + Y + Height - 1 > y2) then
  4584.       Y := y2-y1 - Height + 1
  4585.     else
  4586.       if (Y < 0) then
  4587.         Y := 0;
  4588.   end;
  4589. end; { MoveSaucer }
  4590.  
  4591. var
  4592.   Pausetime : word;
  4593.   Saucer    : pointer;
  4594.   X, Y      : integer;
  4595.   ulx, uly  : word;
  4596.   lrx, lry  : word;
  4597.   Size      : word;
  4598.   I         : word;
  4599. begin
  4600.   ClearDevice;
  4601.   FullPort;
  4602.  
  4603.   { PaintScreen }
  4604.   ClearDevice;
  4605.   MainWindow('GetImage / PutImage Demonstration');
  4606.   StatusLine('Esc aborts or press a key...');
  4607.   GetViewSettings(CurPort);
  4608.  
  4609.   { DrawSaucer }
  4610.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  4611.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  4612.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  4613.   Circle(StartX+10, StartY-12, 2);
  4614.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  4615.   Circle(StartX-10, StartY-12, 2);
  4616.   SetFillStyle(SolidFill, MaxColor);
  4617.   FloodFill(StartX+1, StartY+4, GetColor);
  4618.  
  4619.   { ReadSaucerImage }
  4620.   ulx := StartX-(r+1);
  4621.   uly := StartY-14;
  4622.   lrx := StartX+(r+1);
  4623.   lry := StartY+(r div 3)+3;
  4624.  
  4625.   Size := ImageSize(ulx, uly, lrx, lry);
  4626.   GetMem(Saucer, Size);
  4627.   GetImage(ulx, uly, lrx, lry, Saucer^);
  4628. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  4629.  
  4630.   { Plot some "stars" }
  4631.   for I := 1 to 1000 do
  4632.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  4633.   X := MaxX div 2;
  4634.   Y := MaxY div 2;
  4635.   PauseTime := 70;
  4636.  
  4637.   { Move the saucer around }
  4638.   repeat
  4639. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  4640.      Delay(PauseTime);
  4641. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  4642.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  4643.   until KeyPressed;
  4644.   FreeMem(Saucer, size);
  4645.   WaitToGo;
  4646. end; { PutImagePlay }
  4647.  
  4648. procedure PolyPlay;
  4649. { Draw random polygons with random fill styles on the screen }
  4650. const
  4651.   MaxPts = 5;
  4652. type
  4653.   PolygonType = array[1..MaxPts] of PointType;
  4654. var
  4655.   Poly : PolygonType;
  4656.   I, Color : word;
  4657. begin
  4658.   MainWindow('FillPoly demonstration');
  4659.   StatusLine('Esc aborts or press a key...');
  4660.   repeat
  4661.     Color := RandColor;
  4662.     SetFillStyle(Random(11)+1, Color);
  4663.     SetColor(Color);
  4664.     for I := 1 to MaxPts do
  4665.       with Poly[I] do
  4666.       begin
  4667.         X := Random(MaxX);
  4668.         Y := Random(MaxY);
  4669.       end;
  4670.     FillPoly(MaxPts, Poly);
  4671.   until KeyPressed;
  4672.   WaitToGo;
  4673. end; { PolyPlay }
  4674.  
  4675. procedure FillStylePlay;
  4676. { Display all of the predefined fill styles available }
  4677. var
  4678.   Style    : word;
  4679.   Width    : word;
  4680.   Height   : word;
  4681.   X, Y     : word;
  4682.   I, J     : word;
  4683.   ViewInfo : ViewPortType;
  4684.  
  4685. procedure DrawBox(X, Y : word);
  4686. begin
  4687.   SetFillStyle(Style, MaxColor);
  4688.   with ViewInfo do
  4689.     Bar(X, Y, X+Width, Y+Height);
  4690.   Rectangle(X, Y, X+Width, Y+Height);
  4691.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  4692.   Inc(Style);
  4693. end; { DrawBox }
  4694.  
  4695. begin
  4696.   MainWindow('Pre-defined fill styles');
  4697.   GetViewSettings(ViewInfo);
  4698.   with ViewInfo do
  4699.   begin
  4700.     Width := 2 * ((x2+1) div 13);
  4701.     Height := 2 * ((y2-10) div 10);
  4702.   end;
  4703.   X := Width div 2;
  4704.   Y := Height div 2;
  4705.   Style := 0;
  4706.   for J := 1 to 3 do
  4707.   begin
  4708.     for I := 1 to 4 do
  4709.     begin
  4710.       DrawBox(X, Y);
  4711.       Inc(X, (Width div 2) * 3);
  4712.     end;
  4713.     X := Width div 2;
  4714.     Inc(Y, (Height div 2) * 3);
  4715.   end;
  4716.   SetTextJustify(LeftText, TopText);
  4717.   WaitToGo;
  4718. end; { FillStylePlay }
  4719.  
  4720. procedure FillPatternPlay;
  4721. { Display some user defined fill patterns }
  4722. const
  4723.   Patterns : array[0..11] of FillPatternType = (
  4724.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  4725.             OldColor which has a path of pixels of OldColor or NewColor
  4726.             with sides touching back to the seed point, (XSeed, YSeed).
  4727.             Therefore, only pixels of OldColor are modified and no other
  4728.             information is changed.
  4729.  
  4730.             SEE ALSO
  4731.  
  4732.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4733.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  4734.             SETVIEW
  4735.  
  4736.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  4737.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  4738.             IF WHICHVGA = 0 THEN STOP
  4739.             DUMMY=RES640
  4740.             SETVIEW 100, 100, 539, 379
  4741.             FILLVIEW 10
  4742.             WHILE INKEY$ = ""
  4743.             WEND
  4744.             VIDEOMODESET VMODE
  4745.             END
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.  
  4757.  
  4758.  
  4759.  
  4760.  
  4761.  
  4762.                                                                          63
  4763.  
  4764.  
  4765.  
  4766.  
  4767.  
  4768.  
  4769.           FONTGETINFO
  4770.  
  4771.             PROTOTYPE
  4772.  
  4773.             SUB FONTGETINFO (Width%, Height%)
  4774.  
  4775.             INPUT
  4776.  
  4777.             no input parameters
  4778.     WEND
  4779.             MOUSEEXIT
  4780.             VIDEOMODESET VMODE
  4781.             END
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.                                                                          86
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.  
  4829.           MOUSECURSORDEFAULT
  4830.  
  4831.             PROTOTYPE
  4832.  
  4833.             SUB MOUSECURSORDEFAULT ()
  4834.  
  4835.             INPUT
  4836.  
  4837.             no input parameters
  4838.  
  4839.             OUTPUT
  4840.  
  4841.             no value returned
  4842.  
  4843.             USAGE
  4844.  
  4845.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  4846.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  4847. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  4848. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  4849. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  4850. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  4851. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  4852. $╤
  4853. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  4854. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  4855. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  4856. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  4857. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  4858. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  4859. ░£▒
  4860. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  4861. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  4862.       end;
  4863.     end;
  4864.   end;
  4865.   WaitToGo;
  4866. end; { UserLineStylePlay }
  4867.  
  4868.  
  4869. procedure SayGoodbye;
  4870. { Say goodbye and then exit the program }
  4871. var
  4872.   ViewInfo : ViewPortType;
  4873. begin
  4874.   MainWindow('');
  4875.   GetViewSettings(ViewInfo);
  4876.   SetTextStyle(TriplexFont, HorizDir, 4);
  4877.   SetTextJustify(CenterText, CenterText);
  4878.   with ViewInfo do
  4879.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  4880.   StatusLine('Press any key to quit...');
  4881.   repeat until KeyPressed;
  4882. end; { SayGoodbye }
  4883.  
  4884.  
  4885. PROCEDURE SelectMode;
  4886. VAR
  4887.     choice1,choice2     : CHAR;
  4888.    xsize,ysize            : WORD;
  4889. BEGIN
  4890.     (* Let's select a mode *)
  4891.     ClrScr;
  4892.     WriteLn('VESADEMO:');
  4893.     WriteLn('1. 256 colors');
  4894.     WriteLn('2. 32768 colors');
  4895.     WriteLn('3. 65536 colors');
  4896.     WriteLn('4. 16777216 colors');
  4897.     WriteLn('Q uit');
  4898.     WriteLn;
  4899.     Write('Your choice: ');
  4900.     REPEAT
  4901.         ReadLn(choice1);
  4902.       IF choice1 <> '1' THEN BEGIN
  4903.           WriteLn('Sorry !');
  4904.          WriteLn('This demo wasn''t written for more as 256 colors !');
  4905.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  4906.          WriteLn('Switching to 256 colors.');
  4907.          choice1 := '1';
  4908.       END;
  4909.     UNTIL choice1 IN ['1'..'4','q'];
  4910.     IF choice1 = 'q' THEN Halt;
  4911.  
  4912.     WriteLn;
  4913.     WriteLn;
  4914.     WriteLn('a. 320x200');
  4915.     WriteLn('b. 640x480');
  4916.     WriteLn('c. 800x600');
  4917.     WriteLn('d. 1024x768');
  4918.     WriteLn('e. 1280x1024');
  4919.     WriteLn('Q uit');
  4920.     WriteLn;
  4921.     Write('Your choice: ');
  4922.     REPEAT
  4923.         ReadLn(choice2);
  4924.     UNTIL choice2 IN ['a'..'e','q'];
  4925.     IF choice2 = 'q' THEN Halt;
  4926.  
  4927.     CASE choice2 OF
  4928.         'a' : BEGIN
  4929.             xsize := 320;
  4930.             ysize := 200;
  4931.         END;
  4932.         'b' : BEGIN
  4933.             xsize := 640;
  4934.             ysize := 480;
  4935.         END;
  4936.         'c' : BEGIN
  4937.             xsize := 800;
  4938.             ysize := 600;
  4939.         END;
  4940.         'd' : BEGIN
  4941.             xsize := 1024;
  4942.             ysize := 768;
  4943.         END;
  4944.         'e' : BEGIN
  4945.             xsize := 1280;
  4946.             ysize := 1024;
  4947.         END;
  4948.     END;
  4949.     CASE choice1 OF
  4950.         '1' : mode := FindVesaMode(xsize,ysize,8);
  4951.         '2' : mode := FindVesaMode(xsize,ysize,15);
  4952.         '3' : mode := FindVesaMode(xsize,ysize,16);
  4953.         '4' : mode := FindVesaMode(xsize,ysize,24);
  4954.     END;
  4955.     IF mode = 0 THEN BEGIN
  4956.         WriteLn('No such mode could be found !');
  4957.         WriteLn('Switching to to 320x200.');
  4958.         ReadKey;
  4959.         mode := V320x200x256;
  4960.     END;
  4961. END;
  4962.  
  4963. begin { program body }
  4964.   SelectMode;
  4965.   Initialize;
  4966.   ReportStatus;
  4967.  
  4968. {  AspectRatioPlay; }
  4969.   FillEllipsePlay;
  4970.   SectorPlay;
  4971.   WriteModePlay;
  4972.  
  4973.   ColorPlay;
  4974.   { PalettePlay only intended to work on these drivers: }
  4975.   if (GraphDriver = EGA) or
  4976.       (GraphDriver = EGA64) or
  4977.       (GraphDriver = VGA) then
  4978.      PalettePlay;
  4979.   PutPixelPlay;
  4980. {  PutImagePlay; }
  4981.   RandBarPlay;
  4982.   BarPlay;
  4983.   Bar3DPlay;
  4984.   ArcPlay;
  4985.   CirclePlay;
  4986.   PiePlay;
  4987.   LineToPlay;
  4988.   LineRelPlay;
  4989. {  LineStylePlay; }
  4990. {  UserLineStylePlay; }
  4991.   TextDump;
  4992.   TextPlay;
  4993.   CrtModePlay;
  4994.   FillStylePlay;
  4995.   FillPatternPlay;
  4996.   PolyPlay;
  4997.   SayGoodbye;
  4998. {  CloseGraph; }
  4999.   CloseVesa;
  5000. end.
  5001. ***************************************************
  5002.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  5003.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  5004. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  5005. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  5006. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  5007. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  5008.     Color := RandColor;
  5009.     SetColor(Color);
  5010.     SetFillStyle(Random(CloseDotFill)+1, Color);
  5011.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  5012.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  5013.   until KeyPressed;
  5014.   WaitToGo;
  5015. end; { RandBarPlay }
  5016.  
  5017. procedure ArcPlay;
  5018. { Draw random arcs on the screen }
  5019. var
  5020.   MaxRadius : word;
  5021.   EndAngle : word;
  5022.   ArcInfo : ArcCoordsType;
  5023. begin
  5024.   MainWindow('Arc / GetArcCoords demonstration');
  5025.   StatusLine('Esc aborts or press a key');
  5026.   MaxRadius := MaxY div 10;
  5027.   repeat
  5028.     SetColor(RandColor);
  5029.     EndAngle := Random(360);
  5030.     SetLineStyle(SolidLn, 0, NormWidth);
  5031.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  5032.     GetArcCoords(ArcInfo);
  5033.     with ArcInfo do
  5034.     begin
  5035.       Line(X, Y, XStart, YStart);
  5036.       Line(X, Y, Xend, Yend);
  5037.     end;
  5038.   until KeyPressed;
  5039.   WaitToGo;
  5040. end; { ArcPlay }
  5041.  
  5042. procedure PutPixelPlay;
  5043. { Demonstrate the PutPixel and GetPixel commands }
  5044. const
  5045.   Seed   = 1962; { A seed for the random number generator }
  5046.   NumPts = 2000; { The number of pixels plotted }
  5047.   Esc    = #27;
  5048. var
  5049.   I : word;
  5050.   X, Y, Color : word;
  5051.   XMax, YMax  : integer;
  5052.   ViewInfo    : ViewPortType;
  5053. begin
  5054.   MainWindow('PutPixel / GetPixel demonstration');
  5055.   StatusLine('Esc aborts or press a key...');
  5056.  
  5057.   GetViewSettings(ViewInfo);
  5058.   with ViewInfo do
  5059.   begin
  5060.     XMax := (x2-x1-1);
  5061.     YMax := (y2-y1-1);
  5062.   end;
  5063.  
  5064.   while not KeyPressed do
  5065.   begin
  5066.     { Plot random pixels }
  5067.     RandSeed := Seed;
  5068.     I := 0;
  5069.     while (not KeyPressed) and (I < NumPts) do
  5070.     begin
  5071.       Inc(I);
  5072.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  5073.     end;
  5074.  
  5075.     { Erase pixels }
  5076.     RandSeed := Seed;
  5077.     I := 0;
  5078.     while (not KeyPressed) and (I < NumPts) do
  5079.     begin
  5080.       Inc(I);
  5081.       X := Random(XMax)+1;
  5082.       Y := Random(YMax)+1;
  5083.       Color := GetPixel(X, Y);
  5084.         if Color = RandColor then
  5085.           PutPixel(X, Y, 0);
  5086.      end;
  5087.   end;
  5088.   WaitToGo;
  5089. end; { PutPixelPlay }
  5090.  
  5091. procedure PutImagePlay;
  5092. { Demonstrate the GetImage and PutImage commands }
  5093.  
  5094. const
  5095.   r  = 20;
  5096.   StartX = 100;
  5097.   StartY = 50;
  5098.  
  5099. var
  5100.   CurPort : ViewPortType;
  5101.  
  5102. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  5103. var
  5104.   Step : integer;
  5105. begin
  5106.   Step := Random(2*r);
  5107.   if Odd(Step) then
  5108.     Step := -Step;
  5109.   X := X + Step;
  5110.   Step := Random(r);
  5111.   if Odd(Step) then
  5112.     Step := -Step;
  5113.   Y := Y + Step;
  5114.  
  5115.   { Make saucer bounce off viewport walls }
  5116.   with CurPort do
  5117.   begin
  5118.     if (x1 + X + Width - 1 > x2) then
  5119.       X := x2-x1 - Width + 1
  5120.     else
  5121.       if (X < 0) then
  5122.         X := 0;
  5123.     if (y1 + Y + Height - 1 > y2) then
  5124.       Y := y2-y1 - Height + 1
  5125.     else
  5126.       if (Y < 0) then
  5127.         Y := 0;
  5128.   end;
  5129. end; { MoveSaucer }
  5130.  
  5131. var
  5132.   Pausetime : word;
  5133.   Saucer    : pointer;
  5134.   X, Y      : integer;
  5135.   ulx, uly  : word;
  5136.   lrx, lry  : word;
  5137.   Size      : word;
  5138.   I         : word;
  5139. begin
  5140.   ClearDevice;
  5141.   FullPort;
  5142.  
  5143.   { PaintScreen }
  5144.   ClearDevice;
  5145.   MainWindow('GetImage / PutImage Demonstration');
  5146.   StatusLine('Esc aborts or press a key...');
  5147.   GetViewSettings(CurPort);
  5148.  
  5149.   { DrawSaucer }
  5150.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  5151.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  5152.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  5153.   Circle(StartX+10, StartY-12, 2);
  5154.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  5155.   Circle(StartX-10, StartY-12, 2);
  5156.   SetFillStyle(SolidFill, MaxColor);
  5157.   FloodFill(StartX+1, StartY+4, GetColor);
  5158.  
  5159.   { ReadSaucerImage }
  5160.   ulx := StartX-(r+1);
  5161.   uly := StartY-14;
  5162.   lrx := StartX+(r+1);
  5163.   lry := StartY+(r div 3)+3;
  5164.  
  5165.   Size := ImageSize(ulx, uly, lrx, lry);
  5166.   GetMem(Saucer, Size);
  5167.   GetImage(ulx, uly, lrx, lry, Saucer^);
  5168. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  5169.  
  5170.   { Plot some "stars" }
  5171.   for I := 1 to 1000 do
  5172.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  5173.   X := MaxX div 2;
  5174.   Y := MaxY div 2;
  5175.   PauseTime := 70;
  5176.  
  5177.   { Move the saucer around }
  5178.   repeat
  5179. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  5180.      Delay(PauseTime);
  5181. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  5182.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  5183.   until KeyPressed;
  5184.   FreeMem(Saucer, size);
  5185.   WaitToGo;
  5186. end; { PutImagePlay }
  5187.  
  5188. procedure PolyPlay;
  5189. { Draw random polygons with random fill styles on the screen }
  5190. const
  5191.   MaxPts = 5;
  5192. type
  5193.   PolygonType = array[1..MaxPts] of PointType;
  5194. var
  5195.   Poly : PolygonType;
  5196.   I, Color : word;
  5197. begin
  5198.   MainWindow('FillPoly demonstration');
  5199.   StatusLine('Esc aborts or press a key...');
  5200.   repeat
  5201.     Color := RandColor;
  5202.     SetFillStyle(Random(11)+1, Color);
  5203.     SetColor(Color);
  5204.     for I := 1 to MaxPts do
  5205.       with Poly[I] do
  5206.       begin
  5207.         X := Random(MaxX);
  5208.         Y := Random(MaxY);
  5209.       end;
  5210.     FillPoly(MaxPts, Poly);
  5211.   until KeyPressed;
  5212.   WaitToGo;
  5213. end; { PolyPlay }
  5214.  
  5215. procedure FillStylePlay;
  5216. { Display all of the predefined fill styles available }
  5217. var
  5218.   Style    : word;
  5219.   Width    : word;
  5220.   Height   : word;
  5221.   X, Y     : word;
  5222.   I, J     : word;
  5223.   ViewInfo : ViewPortType;
  5224.  
  5225. procedure DrawBox(X, Y : word);
  5226. begin
  5227.   SetFillStyle(Style, MaxColor);
  5228.   with ViewInfo do
  5229.     Bar(X, Y, X+Width, Y+Height);
  5230.   Rectangle(X, Y, X+Width, Y+Height);
  5231.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  5232.   Inc(Style);
  5233. end; { DrawBox }
  5234.  
  5235. begin
  5236.   MainWindow('Pre-defined fill styles');
  5237.   GetViewSettings(ViewInfo);
  5238.   with ViewInfo do
  5239.   begin
  5240.     Width := 2 * ((x2+1) div 13);
  5241.     Height := 2 * ((y2-10) div 10);
  5242.   end;
  5243.   X := Width div 2;
  5244.   Y := Height div 2;
  5245.   Style := 0;
  5246.   for J := 1 to 3 do
  5247.   begin
  5248.     for I := 1 to 4 do
  5249.     begin
  5250.       DrawBox(X, Y);
  5251.       Inc(X, (Width div 2) * 3);
  5252.     end;
  5253.     X := Width div 2;
  5254.     Inc(Y, (Height div 2) * 3);
  5255.   end;
  5256.   SetTextJustify(LeftText, TopText);
  5257.   WaitToGo;
  5258. end; { FillStylePlay }
  5259.  
  5260. procedure FillPatternPlay;
  5261. { Display some user defined fill patterns }
  5262. const
  5263.   Patterns : array[0..11] of FillPatternType = (
  5264.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  5265.             OldColor which has a path of pixels of OldColor or NewColor
  5266.             with sides touching back to the seed point, (XSeed, YSeed).
  5267.             Therefore, only pixels of OldColor are modified and no other
  5268.             information is changed.
  5269.  
  5270.             SEE ALSO
  5271.  
  5272.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  5273.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  5274.             SETVIEW
  5275.  
  5276.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  5277.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  5278.             IF WHICHVGA = 0 THEN STOP
  5279.             DUMMY=RES640
  5280.             SETVIEW 100, 100, 539, 379
  5281.             FILLVIEW 10
  5282.             WHILE INKEY$ = ""
  5283.             WEND
  5284.             VIDEOMODESET VMODE
  5285.             END
  5286.  
  5287.  
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.                                                                          63
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.           FONTGETINFO
  5310.  
  5311.             PROTOTYPE
  5312.  
  5313.             SUB FONTGETINFO (Width%, Height%)
  5314.  
  5315.             INPUT
  5316.  
  5317.             no input parameters
  5318.     WEND
  5319.             MOUSEEXIT
  5320.             VIDEOMODESET VMODE
  5321.             END
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.  
  5356.  
  5357.  
  5358.  
  5359.  
  5360.  
  5361.  
  5362.                                                                          86
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.           MOUSECURSORDEFAULT
  5370.  
  5371.             PROTOTYPE
  5372.  
  5373.             SUB MOUSECURSORDEFAULT ()
  5374.  
  5375.             INPUT
  5376.  
  5377.             no input parameters
  5378.  
  5379.             OUTPUT
  5380.  
  5381.             no value returned
  5382.  
  5383.             USAGE
  5384.  
  5385.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  5386.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  5387. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  5388. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  5389. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  5390. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  5391. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  5392. $╤
  5393. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  5394. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  5395. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  5396. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  5397. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  5398. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  5399. ░£▒
  5400. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  5401. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  5402.       end;
  5403.     end;
  5404.   end;
  5405.   WaitToGo;
  5406. end; { UserLineStylePlay }
  5407.  
  5408.  
  5409. procedure SayGoodbye;
  5410. { Say goodbye and then exit the program }
  5411. var
  5412.   ViewInfo : ViewPortType;
  5413. begin
  5414.   MainWindow('');
  5415.   GetViewSettings(ViewInfo);
  5416.   SetTextStyle(TriplexFont, HorizDir, 4);
  5417.   SetTextJustify(CenterText, CenterText);
  5418.   with ViewInfo do
  5419.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  5420.   StatusLine('Press any key to quit...');
  5421.   repeat until KeyPressed;
  5422. end; { SayGoodbye }
  5423.  
  5424.  
  5425. PROCEDURE SelectMode;
  5426. VAR
  5427.     choice1,choice2     : CHAR;
  5428.    xsize,ysize            : WORD;
  5429. BEGIN
  5430.     (* Let's select a mode *)
  5431.     ClrScr;
  5432.     WriteLn('VESADEMO:');
  5433.     WriteLn('1. 256 colors');
  5434.     WriteLn('2. 32768 colors');
  5435.     WriteLn('3. 65536 colors');
  5436.     WriteLn('4. 16777216 colors');
  5437.     WriteLn('Q uit');
  5438.     WriteLn;
  5439.     Write('Your choice: ');
  5440.     REPEAT
  5441.         ReadLn(choice1);
  5442.       IF choice1 <> '1' THEN BEGIN
  5443.           WriteLn('Sorry !');
  5444.          WriteLn('This demo wasn''t written for more as 256 colors !');
  5445.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  5446.          WriteLn('Switching to 256 colors.');
  5447.          choice1 := '1';
  5448.       END;
  5449.     UNTIL choice1 IN ['1'..'4','q'];
  5450.     IF choice1 = 'q' THEN Halt;
  5451.  
  5452.     WriteLn;
  5453.     WriteLn;
  5454.     WriteLn('a. 320x200');
  5455.     WriteLn('b. 640x480');
  5456.     WriteLn('c. 800x600');
  5457.     WriteLn('d. 1024x768');
  5458.     WriteLn('e. 1280x1024');
  5459.     WriteLn('Q uit');
  5460.     WriteLn;
  5461.     Write('Your choice: ');
  5462.     REPEAT
  5463.         ReadLn(choice2);
  5464.     UNTIL choice2 IN ['a'..'e','q'];
  5465.     IF choice2 = 'q' THEN Halt;
  5466.  
  5467.     CASE choice2 OF
  5468.         'a' : BEGIN
  5469.             xsize := 320;
  5470.             ysize := 200;
  5471.         END;
  5472.         'b' : BEGIN
  5473.             xsize := 640;
  5474.             ysize := 480;
  5475.         END;
  5476.         'c' : BEGIN
  5477.             xsize := 800;
  5478.             ysize := 600;
  5479.         END;
  5480.         'd' : BEGIN
  5481.             xsize := 1024;
  5482.             ysize := 768;
  5483.         END;
  5484.         'e' : BEGIN
  5485.             xsize := 1280;
  5486.             ysize := 1024;
  5487.         END;
  5488.     END;
  5489.     CASE choice1 OF
  5490.         '1' : mode := FindVesaMode(xsize,ysize,8);
  5491.         '2' : mode := FindVesaMode(xsize,ysize,15);
  5492.         '3' : mode := FindVesaMode(xsize,ysize,16);
  5493.         '4' : mode := FindVesaMode(xsize,ysize,24);
  5494.     END;
  5495.     IF mode = 0 THEN BEGIN
  5496.         WriteLn('No such mode could be found !');
  5497.         WriteLn('Switching to to 320x200.');
  5498.         ReadKey;
  5499.         mode := V320x200x256;
  5500.     END;
  5501. END;
  5502.  
  5503. begin { program body }
  5504.   SelectMode;
  5505.   Initialize;
  5506.   ReportStatus;
  5507.  
  5508. {  AspectRatioPlay; }
  5509.   FillEllipsePlay;
  5510.   SectorPlay;
  5511.   WriteModePlay;
  5512.  
  5513.   ColorPlay;
  5514.   { PalettePlay only intended to work on these drivers: }
  5515.   if (GraphDriver = EGA) or
  5516.       (GraphDriver = EGA64) or
  5517.       (GraphDriver = VGA) then
  5518.      PalettePlay;
  5519.   PutPixelPlay;
  5520. {  PutImagePlay; }
  5521.   RandBarPlay;
  5522.   BarPlay;
  5523.   Bar3DPlay;
  5524.   ArcPlay;
  5525.   CirclePlay;
  5526.   PiePlay;
  5527.   LineToPlay;
  5528.   LineRelPlay;
  5529. {  LineStylePlay; }
  5530. {  UserLineStylePlay; }
  5531.   TextDump;
  5532.   TextPlay;
  5533.   CrtModePlay;
  5534.   FillStylePlay;
  5535.   FillPatternPlay;
  5536.   PolyPlay;
  5537.   SayGoodbye;
  5538. {  CloseGraph; }
  5539.   CloseVesa;
  5540. end.
  5541. ***************************************************
  5542.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  5543.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  5544. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  5545. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  5546. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  5547. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  5548.     Color := RandColor;
  5549.     SetColor(Color);
  5550.     SetFillStyle(Random(CloseDotFill)+1, Color);
  5551.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  5552.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  5553.   until KeyPressed;
  5554.   WaitToGo;
  5555. end; { RandBarPlay }
  5556.  
  5557. procedure ArcPlay;
  5558. { Draw random arcs on the screen }
  5559. var
  5560.   MaxRadius : word;
  5561.   EndAngle : word;
  5562.   ArcInfo : ArcCoordsType;
  5563. begin
  5564.   MainWindow('Arc / GetArcCoords demonstration');
  5565.   StatusLine('Esc aborts or press a key');
  5566.   MaxRadius := MaxY div 10;
  5567.   repeat
  5568.     SetColor(RandColor);
  5569.     EndAngle := Random(360);
  5570.     SetLineStyle(SolidLn, 0, NormWidth);
  5571.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  5572.     GetArcCoords(ArcInfo);
  5573.     with ArcInfo do
  5574.     begin
  5575.       Line(X, Y, XStart, YStart);
  5576.       Line(X, Y, Xend, Yend);
  5577.     end;
  5578.   until KeyPressed;
  5579.   WaitToGo;
  5580. end; { ArcPlay }
  5581.  
  5582. procedure PutPixelPlay;
  5583. { Demonstrate the PutPixel and GetPixel commands }
  5584. const
  5585.   Seed   = 1962; { A seed for the random number generator }
  5586.   NumPts = 2000; { The number of pixels plotted }
  5587.   Esc    = #27;
  5588. var
  5589.   I : word;
  5590.   X, Y, Color : word;
  5591.   XMax, YMax  : integer;
  5592.   ViewInfo    : ViewPortType;
  5593. begin
  5594.   MainWindow('PutPixel / GetPixel demonstration');
  5595.   StatusLine('Esc aborts or press a key...');
  5596.  
  5597.   GetViewSettings(ViewInfo);
  5598.   with ViewInfo do
  5599.   begin
  5600.     XMax := (x2-x1-1);
  5601.     YMax := (y2-y1-1);
  5602.   end;
  5603.  
  5604.   while not KeyPressed do
  5605.   begin
  5606.     { Plot random pixels }
  5607.     RandSeed := Seed;
  5608.     I := 0;
  5609.     while (not KeyPressed) and (I < NumPts) do
  5610.     begin
  5611.       Inc(I);
  5612.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  5613.     end;
  5614.  
  5615.     { Erase pixels }
  5616.     RandSeed := Seed;
  5617.     I := 0;
  5618.     while (not KeyPressed) and (I < NumPts) do
  5619.     begin
  5620.       Inc(I);
  5621.       X := Random(XMax)+1;
  5622.       Y := Random(YMax)+1;
  5623.       Color := GetPixel(X, Y);
  5624.         if Color = RandColor then
  5625.           PutPixel(X, Y, 0);
  5626.      end;
  5627.   end;
  5628.   WaitToGo;
  5629. end; { PutPixelPlay }
  5630.  
  5631. procedure PutImagePlay;
  5632. { Demonstrate the GetImage and PutImage commands }
  5633.  
  5634. const
  5635.   r  = 20;
  5636.   StartX = 100;
  5637.   StartY = 50;
  5638.  
  5639. var
  5640.   CurPort : ViewPortType;
  5641.  
  5642. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  5643. var
  5644.   Step : integer;
  5645. begin
  5646.   Step := Random(2*r);
  5647.   if Odd(Step) then
  5648.     Step := -Step;
  5649.   X := X + Step;
  5650.   Step := Random(r);
  5651.   if Odd(Step) then
  5652.     Step := -Step;
  5653.   Y := Y + Step;
  5654.  
  5655.   { Make saucer bounce off viewport walls }
  5656.   with CurPort do
  5657.   begin
  5658.     if (x1 + X + Width - 1 > x2) then
  5659.       X := x2-x1 - Width + 1
  5660.     else
  5661.       if (X < 0) then
  5662.         X := 0;
  5663.     if (y1 + Y + Height - 1 > y2) then
  5664.       Y := y2-y1 - Height + 1
  5665.     else
  5666.       if (Y < 0) then
  5667.         Y := 0;
  5668.   end;
  5669. end; { MoveSaucer }
  5670.  
  5671. var
  5672.   Pausetime : word;
  5673.   Saucer    : pointer;
  5674.   X, Y      : integer;
  5675.   ulx, uly  : word;
  5676.   lrx, lry  : word;
  5677.   Size      : word;
  5678.   I         : word;
  5679. begin
  5680.   ClearDevice;
  5681.   FullPort;
  5682.  
  5683.   { PaintScreen }
  5684.   ClearDevice;
  5685.   MainWindow('GetImage / PutImage Demonstration');
  5686.   StatusLine('Esc aborts or press a key...');
  5687.   GetViewSettings(CurPort);
  5688.  
  5689.   { DrawSaucer }
  5690.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  5691.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  5692.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  5693.   Circle(StartX+10, StartY-12, 2);
  5694.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  5695.   Circle(StartX-10, StartY-12, 2);
  5696.   SetFillStyle(SolidFill, MaxColor);
  5697.   FloodFill(StartX+1, StartY+4, GetColor);
  5698.  
  5699.   { ReadSaucerImage }
  5700.   ulx := StartX-(r+1);
  5701.   uly := StartY-14;
  5702.   lrx := StartX+(r+1);
  5703.   lry := StartY+(r div 3)+3;
  5704.  
  5705.   Size := ImageSize(ulx, uly, lrx, lry);
  5706.   GetMem(Saucer, Size);
  5707.   GetImage(ulx, uly, lrx, lry, Saucer^);
  5708. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  5709.  
  5710.   { Plot some "stars" }
  5711.   for I := 1 to 1000 do
  5712.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  5713.   X := MaxX div 2;
  5714.   Y := MaxY div 2;
  5715.   PauseTime := 70;
  5716.  
  5717.   { Move the saucer around }
  5718.   repeat
  5719. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  5720.      Delay(PauseTime);
  5721. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  5722.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  5723.   until KeyPressed;
  5724.   FreeMem(Saucer, size);
  5725.   WaitToGo;
  5726. end; { PutImagePlay }
  5727.  
  5728. procedure PolyPlay;
  5729. { Draw random polygons with random fill styles on the screen }
  5730. const
  5731.   MaxPts = 5;
  5732. type
  5733.   PolygonType = array[1..MaxPts] of PointType;
  5734. var
  5735.   Poly : PolygonType;
  5736.   I, Color : word;
  5737. begin
  5738.   MainWindow('FillPoly demonstration');
  5739.   StatusLine('Esc aborts or press a key...');
  5740.   repeat
  5741.     Color := RandColor;
  5742.     SetFillStyle(Random(11)+1, Color);
  5743.     SetColor(Color);
  5744.     for I := 1 to MaxPts do
  5745.       with Poly[I] do
  5746.       begin
  5747.         X := Random(MaxX);
  5748.         Y := Random(MaxY);
  5749.       end;
  5750.     FillPoly(MaxPts, Poly);
  5751.   until KeyPressed;
  5752.   WaitToGo;
  5753. end; { PolyPlay }
  5754.  
  5755. procedure FillStylePlay;
  5756. { Display all of the predefined fill styles available }
  5757. var
  5758.   Style    : word;
  5759.   Width    : word;
  5760.   Height   : word;
  5761.   X, Y     : word;
  5762.   I, J     : word;
  5763.   ViewInfo : ViewPortType;
  5764.  
  5765. procedure DrawBox(X, Y : word);
  5766. begin
  5767.   SetFillStyle(Style, MaxColor);
  5768.   with ViewInfo do
  5769.     Bar(X, Y, X+Width, Y+Height);
  5770.   Rectangle(X, Y, X+Width, Y+Height);
  5771.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  5772.   Inc(Style);
  5773. end; { DrawBox }
  5774.  
  5775. begin
  5776.   MainWindow('Pre-defined fill styles');
  5777.   GetViewSettings(ViewInfo);
  5778.   with ViewInfo do
  5779.   begin
  5780.     Width := 2 * ((x2+1) div 13);
  5781.     Height := 2 * ((y2-10) div 10);
  5782.   end;
  5783.   X := Width div 2;
  5784.   Y := Height div 2;
  5785.   Style := 0;
  5786.   for J := 1 to 3 do
  5787.   begin
  5788.     for I := 1 to 4 do
  5789.     begin
  5790.       DrawBox(X, Y);
  5791.       Inc(X, (Width div 2) * 3);
  5792.     end;
  5793.     X := Width div 2;
  5794.     Inc(Y, (Height div 2) * 3);
  5795.   end;
  5796.   SetTextJustify(LeftText, TopText);
  5797.   WaitToGo;
  5798. end; { FillStylePlay }
  5799.  
  5800. procedure FillPatternPlay;
  5801. { Display some user defined fill patterns }
  5802. const
  5803.   Patterns : array[0..11] of FillPatternType = (
  5804.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  5805.             OldColor which has a path of pixels of OldColor or NewColor
  5806.             with sides touching back to the seed point, (XSeed, YSeed).
  5807.             Therefore, only pixels of OldColor are modified and no other
  5808.             information is changed.
  5809.  
  5810.             SEE ALSO
  5811.  
  5812.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  5813.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  5814.             SETVIEW
  5815.  
  5816.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  5817.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  5818.             IF WHICHVGA = 0 THEN STOP
  5819.             DUMMY=RES640
  5820.             SETVIEW 100, 100, 539, 379
  5821.             FILLVIEW 10
  5822.             WHILE INKEY$ = ""
  5823.             WEND
  5824.             VIDEOMODESET VMODE
  5825.             END
  5826.  
  5827.  
  5828.  
  5829.  
  5830.  
  5831.  
  5832.  
  5833.  
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.                                                                          63
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.           FONTGETINFO
  5850.  
  5851.             PROTOTYPE
  5852.  
  5853.             SUB FONTGETINFO (Width%, Height%)
  5854.  
  5855.             INPUT
  5856.  
  5857.             no input parameters
  5858.     WEND
  5859.             MOUSEEXIT
  5860.             VIDEOMODESET VMODE
  5861.             END
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.  
  5883.  
  5884.  
  5885.  
  5886.  
  5887.  
  5888.  
  5889.  
  5890.  
  5891.  
  5892.  
  5893.  
  5894.  
  5895.  
  5896.  
  5897.  
  5898.  
  5899.  
  5900.  
  5901.  
  5902.                                                                          86
  5903.  
  5904.  
  5905.  
  5906.  
  5907.  
  5908.  
  5909.           MOUSECURSORDEFAULT
  5910.  
  5911.             PROTOTYPE
  5912.  
  5913.             SUB MOUSECURSORDEFAULT ()
  5914.  
  5915.             INPUT
  5916.  
  5917.             no input parameters
  5918.  
  5919.             OUTPUT
  5920.  
  5921.             no value returned
  5922.  
  5923.             USAGE
  5924.  
  5925.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  5926.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  5927. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  5928. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  5929. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  5930. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  5931. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  5932. $╤
  5933. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  5934. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  5935. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  5936. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  5937. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  5938. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  5939. ░£▒
  5940. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  5941. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  5942.       end;
  5943.     end;
  5944.   end;
  5945.   WaitToGo;
  5946. end; { UserLineStylePlay }
  5947.  
  5948.  
  5949. procedure SayGoodbye;
  5950. { Say goodbye and then exit the program }
  5951. var
  5952.   ViewInfo : ViewPortType;
  5953. begin
  5954.   MainWindow('');
  5955.   GetViewSettings(ViewInfo);
  5956.   SetTextStyle(TriplexFont, HorizDir, 4);
  5957.   SetTextJustify(CenterText, CenterText);
  5958.   with ViewInfo do
  5959.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  5960.   StatusLine('Press any key to quit...');
  5961.   repeat until KeyPressed;
  5962. end; { SayGoodbye }
  5963.  
  5964.  
  5965. PROCEDURE SelectMode;
  5966. VAR
  5967.     choice1,choice2     : CHAR;
  5968.    xsize,ysize            : WORD;
  5969. BEGIN
  5970.     (* Let's select a mode *)
  5971.     ClrScr;
  5972.     WriteLn('VESADEMO:');
  5973.     WriteLn('1. 256 colors');
  5974.     WriteLn('2. 32768 colors');
  5975.     WriteLn('3. 65536 colors');
  5976.     WriteLn('4. 16777216 colors');
  5977.     WriteLn('Q uit');
  5978.     WriteLn;
  5979.     Write('Your choice: ');
  5980.     REPEAT
  5981.         ReadLn(choice1);
  5982.       IF choice1 <> '1' THEN BEGIN
  5983.           WriteLn('Sorry !');
  5984.          WriteLn('This demo wasn''t written for more as 256 colors !');
  5985.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  5986.          WriteLn('Switching to 256 colors.');
  5987.          choice1 := '1';
  5988.       END;
  5989.     UNTIL choice1 IN ['1'..'4','q'];
  5990.     IF choice1 = 'q' THEN Halt;
  5991.  
  5992.     WriteLn;
  5993.     WriteLn;
  5994.     WriteLn('a. 320x200');
  5995.     WriteLn('b. 640x480');
  5996.     WriteLn('c. 800x600');
  5997.     WriteLn('d. 1024x768');
  5998.     WriteLn('e. 1280x1024');
  5999.     WriteLn('Q uit');
  6000.     WriteLn;
  6001.     Write('Your choice: ');
  6002.     REPEAT
  6003.         ReadLn(choice2);
  6004.     UNTIL choice2 IN ['a'..'e','q'];
  6005.     IF choice2 = 'q' THEN Halt;
  6006.  
  6007.     CASE choice2 OF
  6008.         'a' : BEGIN
  6009.             xsize := 320;
  6010.             ysize := 200;
  6011.         END;
  6012.         'b' : BEGIN
  6013.             xsize := 640;
  6014.             ysize := 480;
  6015.         END;
  6016.         'c' : BEGIN
  6017.             xsize := 800;
  6018.             ysize := 600;
  6019.         END;
  6020.         'd' : BEGIN
  6021.             xsize := 1024;
  6022.             ysize := 768;
  6023.         END;
  6024.         'e' : BEGIN
  6025.             xsize := 1280;
  6026.             ysize := 1024;
  6027.         END;
  6028.     END;
  6029.     CASE choice1 OF
  6030.         '1' : mode := FindVesaMode(xsize,ysize,8);
  6031.         '2' : mode := FindVesaMode(xsize,ysize,15);
  6032.         '3' : mode := FindVesaMode(xsize,ysize,16);
  6033.         '4' : mode := FindVesaMode(xsize,ysize,24);
  6034.     END;
  6035.     IF mode = 0 THEN BEGIN
  6036.         WriteLn('No such mode could be found !');
  6037.         WriteLn('Switching to to 320x200.');
  6038.         ReadKey;
  6039.         mode := V320x200x256;
  6040.     END;
  6041. END;
  6042.  
  6043. begin { program body }
  6044.   SelectMode;
  6045.   Initialize;
  6046.   ReportStatus;
  6047.  
  6048. {  AspectRatioPlay; }
  6049.   FillEllipsePlay;
  6050.   SectorPlay;
  6051.   WriteModePlay;
  6052.  
  6053.   ColorPlay;
  6054.   { PalettePlay only intended to work on these drivers: }
  6055.   if (GraphDriver = EGA) or
  6056.       (GraphDriver = EGA64) or
  6057.       (GraphDriver = VGA) then
  6058.      PalettePlay;
  6059.   PutPixelPlay;
  6060. {  PutImagePlay; }
  6061.   RandBarPlay;
  6062.   BarPlay;
  6063.   Bar3DPlay;
  6064.   ArcPlay;
  6065.   CirclePlay;
  6066.   PiePlay;
  6067.   LineToPlay;
  6068.   LineRelPlay;
  6069. {  LineStylePlay; }
  6070. {  UserLineStylePlay; }
  6071.   TextDump;
  6072.   TextPlay;
  6073.   CrtModePlay;
  6074.   FillStylePlay;
  6075.   FillPatternPlay;
  6076.   PolyPlay;
  6077.   SayGoodbye;
  6078. {  CloseGraph; }
  6079.   CloseVesa;
  6080. end.
  6081. ***************************************************
  6082.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  6083.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  6084. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  6085. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  6086. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  6087. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  6088.     Color := RandColor;
  6089.     SetColor(Color);
  6090.     SetFillStyle(Random(CloseDotFill)+1, Color);
  6091.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  6092.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  6093.   until KeyPressed;
  6094.   WaitToGo;
  6095. end; { RandBarPlay }
  6096.  
  6097. procedure ArcPlay;
  6098. { Draw random arcs on the screen }
  6099. var
  6100.   MaxRadius : word;
  6101.   EndAngle : word;
  6102.   ArcInfo : ArcCoordsType;
  6103. begin
  6104.   MainWindow('Arc / GetArcCoords demonstration');
  6105.   StatusLine('Esc aborts or press a key');
  6106.   MaxRadius := MaxY div 10;
  6107.   repeat
  6108.     SetColor(RandColor);
  6109.     EndAngle := Random(360);
  6110.     SetLineStyle(SolidLn, 0, NormWidth);
  6111.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  6112.     GetArcCoords(ArcInfo);
  6113.     with ArcInfo do
  6114.     begin
  6115.       Line(X, Y, XStart, YStart);
  6116.       Line(X, Y, Xend, Yend);
  6117.     end;
  6118.   until KeyPressed;
  6119.   WaitToGo;
  6120. end; { ArcPlay }
  6121.  
  6122. procedure PutPixelPlay;
  6123. { Demonstrate the PutPixel and GetPixel commands }
  6124. const
  6125.   Seed   = 1962; { A seed for the random number generator }
  6126.   NumPts = 2000; { The number of pixels plotted }
  6127.   Esc    = #27;
  6128. var
  6129.   I : word;
  6130.   X, Y, Color : word;
  6131.   XMax, YMax  : integer;
  6132.   ViewInfo    : ViewPortType;
  6133. begin
  6134.   MainWindow('PutPixel / GetPixel demonstration');
  6135.   StatusLine('Esc aborts or press a key...');
  6136.  
  6137.   GetViewSettings(ViewInfo);
  6138.   with ViewInfo do
  6139.   begin
  6140.     XMax := (x2-x1-1);
  6141.     YMax := (y2-y1-1);
  6142.   end;
  6143.  
  6144.   while not KeyPressed do
  6145.   begin
  6146.     { Plot random pixels }
  6147.     RandSeed := Seed;
  6148.     I := 0;
  6149.     while (not KeyPressed) and (I < NumPts) do
  6150.     begin
  6151.       Inc(I);
  6152.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  6153.     end;
  6154.  
  6155.     { Erase pixels }
  6156.     RandSeed := Seed;
  6157.     I := 0;
  6158.     while (not KeyPressed) and (I < NumPts) do
  6159.     begin
  6160.       Inc(I);
  6161.       X := Random(XMax)+1;
  6162.       Y := Random(YMax)+1;
  6163.       Color := GetPixel(X, Y);
  6164.         if Color = RandColor then
  6165.           PutPixel(X, Y, 0);
  6166.      end;
  6167.   end;
  6168.   WaitToGo;
  6169. end; { PutPixelPlay }
  6170.  
  6171. procedure PutImagePlay;
  6172. { Demonstrate the GetImage and PutImage commands }
  6173.  
  6174. const
  6175.   r  = 20;
  6176.   StartX = 100;
  6177.   StartY = 50;
  6178.  
  6179. var
  6180.   CurPort : ViewPortType;
  6181.  
  6182. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  6183. var
  6184.   Step : integer;
  6185. begin
  6186.   Step := Random(2*r);
  6187.   if Odd(Step) then
  6188.     Step := -Step;
  6189.   X := X + Step;
  6190.   Step := Random(r);
  6191.   if Odd(Step) then
  6192.     Step := -Step;
  6193.   Y := Y + Step;
  6194.  
  6195.   { Make saucer bounce off viewport walls }
  6196.   with CurPort do
  6197.   begin
  6198.     if (x1 + X + Width - 1 > x2) then
  6199.       X := x2-x1 - Width + 1
  6200.     else
  6201.       if (X < 0) then
  6202.         X := 0;
  6203.     if (y1 + Y + Height - 1 > y2) then
  6204.       Y := y2-y1 - Height + 1
  6205.     else
  6206.       if (Y < 0) then
  6207.         Y := 0;
  6208.   end;
  6209. end; { MoveSaucer }
  6210.  
  6211. var
  6212.   Pausetime : word;
  6213.   Saucer    : pointer;
  6214.   X, Y      : integer;
  6215.   ulx, uly  : word;
  6216.   lrx, lry  : word;
  6217.   Size      : word;
  6218.   I         : word;
  6219. begin
  6220.   ClearDevice;
  6221.   FullPort;
  6222.  
  6223.   { PaintScreen }
  6224.   ClearDevice;
  6225.   MainWindow('GetImage / PutImage Demonstration');
  6226.   StatusLine('Esc aborts or press a key...');
  6227.   GetViewSettings(CurPort);
  6228.  
  6229.   { DrawSaucer }
  6230.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  6231.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  6232.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  6233.   Circle(StartX+10, StartY-12, 2);
  6234.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  6235.   Circle(StartX-10, StartY-12, 2);
  6236.   SetFillStyle(SolidFill, MaxColor);
  6237.   FloodFill(StartX+1, StartY+4, GetColor);
  6238.  
  6239.   { ReadSaucerImage }
  6240.   ulx := StartX-(r+1);
  6241.   uly := StartY-14;
  6242.   lrx := StartX+(r+1);
  6243.   lry := StartY+(r div 3)+3;
  6244.  
  6245.   Size := ImageSize(ulx, uly, lrx, lry);
  6246.   GetMem(Saucer, Size);
  6247.   GetImage(ulx, uly, lrx, lry, Saucer^);
  6248. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  6249.  
  6250.   { Plot some "stars" }
  6251.   for I := 1 to 1000 do
  6252.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  6253.   X := MaxX div 2;
  6254.   Y := MaxY div 2;
  6255.   PauseTime := 70;
  6256.  
  6257.   { Move the saucer around }
  6258.   repeat
  6259. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  6260.      Delay(PauseTime);
  6261. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  6262.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  6263.   until KeyPressed;
  6264.   FreeMem(Saucer, size);
  6265.   WaitToGo;
  6266. end; { PutImagePlay }
  6267.  
  6268. procedure PolyPlay;
  6269. { Draw random polygons with random fill styles on the screen }
  6270. const
  6271.   MaxPts = 5;
  6272. type
  6273.   PolygonType = array[1..MaxPts] of PointType;
  6274. var
  6275.   Poly : PolygonType;
  6276.   I, Color : word;
  6277. begin
  6278.   MainWindow('FillPoly demonstration');
  6279.   StatusLine('Esc aborts or press a key...');
  6280.   repeat
  6281.     Color := RandColor;
  6282.     SetFillStyle(Random(11)+1, Color);
  6283.     SetColor(Color);
  6284.     for I := 1 to MaxPts do
  6285.       with Poly[I] do
  6286.       begin
  6287.         X := Random(MaxX);
  6288.         Y := Random(MaxY);
  6289.       end;
  6290.     FillPoly(MaxPts, Poly);
  6291.   until KeyPressed;
  6292.   WaitToGo;
  6293. end; { PolyPlay }
  6294.  
  6295. procedure FillStylePlay;
  6296. { Display all of the predefined fill styles available }
  6297. var
  6298.   Style    : word;
  6299.   Width    : word;
  6300.   Height   : word;
  6301.   X, Y     : word;
  6302.   I, J     : word;
  6303.   ViewInfo : ViewPortType;
  6304.  
  6305. procedure DrawBox(X, Y : word);
  6306. begin
  6307.   SetFillStyle(Style, MaxColor);
  6308.   with ViewInfo do
  6309.     Bar(X, Y, X+Width, Y+Height);
  6310.   Rectangle(X, Y, X+Width, Y+Height);
  6311.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  6312.   Inc(Style);
  6313. end; { DrawBox }
  6314.  
  6315. begin
  6316.   MainWindow('Pre-defined fill styles');
  6317.   GetViewSettings(ViewInfo);
  6318.   with ViewInfo do
  6319.   begin
  6320.     Width := 2 * ((x2+1) div 13);
  6321.     Height := 2 * ((y2-10) div 10);
  6322.   end;
  6323.   X := Width div 2;
  6324.   Y := Height div 2;
  6325.   Style := 0;
  6326.   for J := 1 to 3 do
  6327.   begin
  6328.     for I := 1 to 4 do
  6329.     begin
  6330.       DrawBox(X, Y);
  6331.       Inc(X, (Width div 2) * 3);
  6332.     end;
  6333.     X := Width div 2;
  6334.     Inc(Y, (Height div 2) * 3);
  6335.   end;
  6336.   SetTextJustify(LeftText, TopText);
  6337.   WaitToGo;
  6338. end; { FillStylePlay }
  6339.  
  6340. procedure FillPatternPlay;
  6341. { Display some user defined fill patterns }
  6342. const
  6343.   Patterns : array[0..11] of FillPatternType = (
  6344.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  6345.             OldColor which has a path of pixels of OldColor or NewColor
  6346.             with sides touching back to the seed point, (XSeed, YSeed).
  6347.             Therefore, only pixels of OldColor are modified and no other
  6348.             information is changed.
  6349.  
  6350.             SEE ALSO
  6351.  
  6352.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  6353.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  6354.             SETVIEW
  6355.  
  6356.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  6357.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  6358.             IF WHICHVGA = 0 THEN STOP
  6359.             DUMMY=RES640
  6360.             SETVIEW 100, 100, 539, 379
  6361.             FILLVIEW 10
  6362.             WHILE INKEY$ = ""
  6363.             WEND
  6364.             VIDEOMODESET VMODE
  6365.             END
  6366.  
  6367.  
  6368.  
  6369.  
  6370.  
  6371.  
  6372.  
  6373.  
  6374.  
  6375.  
  6376.  
  6377.  
  6378.  
  6379.  
  6380.  
  6381.  
  6382.                                                                          63
  6383.  
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389.           FONTGETINFO
  6390.  
  6391.             PROTOTYPE
  6392.  
  6393.             SUB FONTGETINFO (Width%, Height%)
  6394.  
  6395.             INPUT
  6396.  
  6397.             no input parameters
  6398.     WEND
  6399.             MOUSEEXIT
  6400.             VIDEOMODESET VMODE
  6401.             END
  6402.  
  6403.  
  6404.  
  6405.  
  6406.  
  6407.  
  6408.  
  6409.  
  6410.  
  6411.  
  6412.  
  6413.  
  6414.  
  6415.  
  6416.  
  6417.  
  6418.  
  6419.  
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.                                                                          86
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.           MOUSECURSORDEFAULT
  6450.  
  6451.             PROTOTYPE
  6452.  
  6453.             SUB MOUSECURSORDEFAULT ()
  6454.  
  6455.             INPUT
  6456.  
  6457.             no input parameters
  6458.  
  6459.             OUTPUT
  6460.  
  6461.             no value returned
  6462.  
  6463.             USAGE
  6464.  
  6465.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  6466.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  6467. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  6468. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  6469. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  6470. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  6471. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  6472. $╤
  6473. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  6474. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  6475. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  6476. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  6477. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  6478. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  6479. ░£▒
  6480. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  6481. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  6482.       end;
  6483.     end;
  6484.   end;
  6485.   WaitToGo;
  6486. end; { UserLineStylePlay }
  6487.  
  6488.  
  6489. procedure SayGoodbye;
  6490. { Say goodbye and then exit the program }
  6491. var
  6492.   ViewInfo : ViewPortType;
  6493. begin
  6494.   MainWindow('');
  6495.   GetViewSettings(ViewInfo);
  6496.   SetTextStyle(TriplexFont, HorizDir, 4);
  6497.   SetTextJustify(CenterText, CenterText);
  6498.   with ViewInfo do
  6499.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  6500.   StatusLine('Press any key to quit...');
  6501.   repeat until KeyPressed;
  6502. end; { SayGoodbye }
  6503.  
  6504.  
  6505. PROCEDURE SelectMode;
  6506. VAR
  6507.     choice1,choice2     : CHAR;
  6508.    xsize,ysize            : WORD;
  6509. BEGIN
  6510.     (* Let's select a mode *)
  6511.     ClrScr;
  6512.     WriteLn('VESADEMO:');
  6513.     WriteLn('1. 256 colors');
  6514.     WriteLn('2. 32768 colors');
  6515.     WriteLn('3. 65536 colors');
  6516.     WriteLn('4. 16777216 colors');
  6517.     WriteLn('Q uit');
  6518.     WriteLn;
  6519.     Write('Your choice: ');
  6520.     REPEAT
  6521.         ReadLn(choice1);
  6522.       IF choice1 <> '1' THEN BEGIN
  6523.           WriteLn('Sorry !');
  6524.          WriteLn('This demo wasn''t written for more as 256 colors !');
  6525.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  6526.          WriteLn('Switching to 256 colors.');
  6527.          choice1 := '1';
  6528.       END;
  6529.     UNTIL choice1 IN ['1'..'4','q'];
  6530.     IF choice1 = 'q' THEN Halt;
  6531.  
  6532.     WriteLn;
  6533.     WriteLn;
  6534.     WriteLn('a. 320x200');
  6535.     WriteLn('b. 640x480');
  6536.     WriteLn('c. 800x600');
  6537.     WriteLn('d. 1024x768');
  6538.     WriteLn('e. 1280x1024');
  6539.     WriteLn('Q uit');
  6540.     WriteLn;
  6541.     Write('Your choice: ');
  6542.     REPEAT
  6543.         ReadLn(choice2);
  6544.     UNTIL choice2 IN ['a'..'e','q'];
  6545.     IF choice2 = 'q' THEN Halt;
  6546.  
  6547.     CASE choice2 OF
  6548.         'a' : BEGIN
  6549.             xsize := 320;
  6550.             ysize := 200;
  6551.         END;
  6552.         'b' : BEGIN
  6553.             xsize := 640;
  6554.             ysize := 480;
  6555.         END;
  6556.         'c' : BEGIN
  6557.             xsize := 800;
  6558.             ysize := 600;
  6559.         END;
  6560.         'd' : BEGIN
  6561.             xsize := 1024;
  6562.             ysize := 768;
  6563.         END;
  6564.         'e' : BEGIN
  6565.             xsize := 1280;
  6566.             ysize := 1024;
  6567.         END;
  6568.     END;
  6569.     CASE choice1 OF
  6570.         '1' : mode := FindVesaMode(xsize,ysize,8);
  6571.         '2' : mode := FindVesaMode(xsize,ysize,15);
  6572.         '3' : mode := FindVesaMode(xsize,ysize,16);
  6573.         '4' : mode := FindVesaMode(xsize,ysize,24);
  6574.     END;
  6575.     IF mode = 0 THEN BEGIN
  6576.         WriteLn('No such mode could be found !');
  6577.         WriteLn('Switching to to 320x200.');
  6578.         ReadKey;
  6579.         mode := V320x200x256;
  6580.     END;
  6581. END;
  6582.  
  6583. begin { program body }
  6584.   SelectMode;
  6585.   Initialize;
  6586.   ReportStatus;
  6587.  
  6588. {  AspectRatioPlay; }
  6589.   FillEllipsePlay;
  6590.   SectorPlay;
  6591.   WriteModePlay;
  6592.  
  6593.   ColorPlay;
  6594.   { PalettePlay only intended to work on these drivers: }
  6595.   if (GraphDriver = EGA) or
  6596.       (GraphDriver = EGA64) or
  6597.       (GraphDriver = VGA) then
  6598.      PalettePlay;
  6599.   PutPixelPlay;
  6600. {  PutImagePlay; }
  6601.   RandBarPlay;
  6602.   BarPlay;
  6603.   Bar3DPlay;
  6604.   ArcPlay;
  6605.   CirclePlay;
  6606.   PiePlay;
  6607.   LineToPlay;
  6608.   LineRelPlay;
  6609. {  LineStylePlay; }
  6610. {  UserLineStylePlay; }
  6611.   TextDump;
  6612.   TextPlay;
  6613.   CrtModePlay;
  6614.   FillStylePlay;
  6615.   FillPatternPlay;
  6616.   PolyPlay;
  6617.   SayGoodbye;
  6618. {  CloseGraph; }
  6619.   CloseVesa;
  6620. end.
  6621. ***************************************************
  6622.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  6623.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  6624. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  6625. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  6626. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  6627. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  6628.     Color := RandColor;
  6629.     SetColor(Color);
  6630.     SetFillStyle(Random(CloseDotFill)+1, Color);
  6631.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  6632.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  6633.   until KeyPressed;
  6634.   WaitToGo;
  6635. end; { RandBarPlay }
  6636.  
  6637. procedure ArcPlay;
  6638. { Draw random arcs on the screen }
  6639. var
  6640.   MaxRadius : word;
  6641.   EndAngle : word;
  6642.   ArcInfo : ArcCoordsType;
  6643. begin
  6644.   MainWindow('Arc / GetArcCoords demonstration');
  6645.   StatusLine('Esc aborts or press a key');
  6646.   MaxRadius := MaxY div 10;
  6647.   repeat
  6648.     SetColor(RandColor);
  6649.     EndAngle := Random(360);
  6650.     SetLineStyle(SolidLn, 0, NormWidth);
  6651.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  6652.     GetArcCoords(ArcInfo);
  6653.     with ArcInfo do
  6654.     begin
  6655.       Line(X, Y, XStart, YStart);
  6656.       Line(X, Y, Xend, Yend);
  6657.     end;
  6658.   until KeyPressed;
  6659.   WaitToGo;
  6660. end; { ArcPlay }
  6661.  
  6662. procedure PutPixelPlay;
  6663. { Demonstrate the PutPixel and GetPixel commands }
  6664. const
  6665.   Seed   = 1962; { A seed for the random number generator }
  6666.   NumPts = 2000; { The number of pixels plotted }
  6667.   Esc    = #27;
  6668. var
  6669.   I : word;
  6670.   X, Y, Color : word;
  6671.   XMax, YMax  : integer;
  6672.   ViewInfo    : ViewPortType;
  6673. begin
  6674.   MainWindow('PutPixel / GetPixel demonstration');
  6675.   StatusLine('Esc aborts or press a key...');
  6676.  
  6677.   GetViewSettings(ViewInfo);
  6678.   with ViewInfo do
  6679.   begin
  6680.     XMax := (x2-x1-1);
  6681.     YMax := (y2-y1-1);
  6682.   end;
  6683.  
  6684.   while not KeyPressed do
  6685.   begin
  6686.     { Plot random pixels }
  6687.     RandSeed := Seed;
  6688.     I := 0;
  6689.     while (not KeyPressed) and (I < NumPts) do
  6690.     begin
  6691.       Inc(I);
  6692.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  6693.     end;
  6694.  
  6695.     { Erase pixels }
  6696.     RandSeed := Seed;
  6697.     I := 0;
  6698.     while (not KeyPressed) and (I < NumPts) do
  6699.     begin
  6700.       Inc(I);
  6701.       X := Random(XMax)+1;
  6702.       Y := Random(YMax)+1;
  6703.       Color := GetPixel(X, Y);
  6704.         if Color = RandColor then
  6705.           PutPixel(X, Y, 0);
  6706.      end;
  6707.   end;
  6708.   WaitToGo;
  6709. end; { PutPixelPlay }
  6710.  
  6711. procedure PutImagePlay;
  6712. { Demonstrate the GetImage and PutImage commands }
  6713.  
  6714. const
  6715.   r  = 20;
  6716.   StartX = 100;
  6717.   StartY = 50;
  6718.  
  6719. var
  6720.   CurPort : ViewPortType;
  6721.  
  6722. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  6723. var
  6724.   Step : integer;
  6725. begin
  6726.   Step := Random(2*r);
  6727.   if Odd(Step) then
  6728.     Step := -Step;
  6729.   X := X + Step;
  6730.   Step := Random(r);
  6731.   if Odd(Step) then
  6732.     Step := -Step;
  6733.   Y := Y + Step;
  6734.  
  6735.   { Make saucer bounce off viewport walls }
  6736.   with CurPort do
  6737.   begin
  6738.     if (x1 + X + Width - 1 > x2) then
  6739.       X := x2-x1 - Width + 1
  6740.     else
  6741.       if (X < 0) then
  6742.         X := 0;
  6743.     if (y1 + Y + Height - 1 > y2) then
  6744.       Y := y2-y1 - Height + 1
  6745.     else
  6746.       if (Y < 0) then
  6747.         Y := 0;
  6748.   end;
  6749. end; { MoveSaucer }
  6750.  
  6751. var
  6752.   Pausetime : word;
  6753.   Saucer    : pointer;
  6754.   X, Y      : integer;
  6755.   ulx, uly  : word;
  6756.   lrx, lry  : word;
  6757.   Size      : word;
  6758.   I         : word;
  6759. begin
  6760.   ClearDevice;
  6761.   FullPort;
  6762.  
  6763.   { PaintScreen }
  6764.   ClearDevice;
  6765.   MainWindow('GetImage / PutImage Demonstration');
  6766.   StatusLine('Esc aborts or press a key...');
  6767.   GetViewSettings(CurPort);
  6768.  
  6769.   { DrawSaucer }
  6770.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  6771.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  6772.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  6773.   Circle(StartX+10, StartY-12, 2);
  6774.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  6775.   Circle(StartX-10, StartY-12, 2);
  6776.   SetFillStyle(SolidFill, MaxColor);
  6777.   FloodFill(StartX+1, StartY+4, GetColor);
  6778.  
  6779.   { ReadSaucerImage }
  6780.   ulx := StartX-(r+1);
  6781.   uly := StartY-14;
  6782.   lrx := StartX+(r+1);
  6783.   lry := StartY+(r div 3)+3;
  6784.  
  6785.   Size := ImageSize(ulx, uly, lrx, lry);
  6786.   GetMem(Saucer, Size);
  6787.   GetImage(ulx, uly, lrx, lry, Saucer^);
  6788. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  6789.  
  6790.   { Plot some "stars" }
  6791.   for I := 1 to 1000 do
  6792.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  6793.   X := MaxX div 2;
  6794.   Y := MaxY div 2;
  6795.   PauseTime := 70;
  6796.  
  6797.   { Move the saucer around }
  6798.   repeat
  6799. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  6800.      Delay(PauseTime);
  6801. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  6802.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  6803.   until KeyPressed;
  6804.   FreeMem(Saucer, size);
  6805.   WaitToGo;
  6806. end; { PutImagePlay }
  6807.  
  6808. procedure PolyPlay;
  6809. { Draw random polygons with random fill styles on the screen }
  6810. const
  6811.   MaxPts = 5;
  6812. type
  6813.   PolygonType = array[1..MaxPts] of PointType;
  6814. var
  6815.   Poly : PolygonType;
  6816.   I, Color : word;
  6817. begin
  6818.   MainWindow('FillPoly demonstration');
  6819.   StatusLine('Esc aborts or press a key...');
  6820.   repeat
  6821.     Color := RandColor;
  6822.     SetFillStyle(Random(11)+1, Color);
  6823.     SetColor(Color);
  6824.     for I := 1 to MaxPts do
  6825.       with Poly[I] do
  6826.       begin
  6827.         X := Random(MaxX);
  6828.         Y := Random(MaxY);
  6829.       end;
  6830.     FillPoly(MaxPts, Poly);
  6831.   until KeyPressed;
  6832.   WaitToGo;
  6833. end; { PolyPlay }
  6834.  
  6835. procedure FillStylePlay;
  6836. { Display all of the predefined fill styles available }
  6837. var
  6838.   Style    : word;
  6839.   Width    : word;
  6840.   Height   : word;
  6841.   X, Y     : word;
  6842.   I, J     : word;
  6843.   ViewInfo : ViewPortType;
  6844.  
  6845. procedure DrawBox(X, Y : word);
  6846. begin
  6847.   SetFillStyle(Style, MaxColor);
  6848.   with ViewInfo do
  6849.     Bar(X, Y, X+Width, Y+Height);
  6850.   Rectangle(X, Y, X+Width, Y+Height);
  6851.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  6852.   Inc(Style);
  6853. end; { DrawBox }
  6854.  
  6855. begin
  6856.   MainWindow('Pre-defined fill styles');
  6857.   GetViewSettings(ViewInfo);
  6858.   with ViewInfo do
  6859.   begin
  6860.     Width := 2 * ((x2+1) div 13);
  6861.     Height := 2 * ((y2-10) div 10);
  6862.   end;
  6863.   X := Width div 2;
  6864.   Y := Height div 2;
  6865.   Style := 0;
  6866.   for J := 1 to 3 do
  6867.   begin
  6868.     for I := 1 to 4 do
  6869.     begin
  6870.       DrawBox(X, Y);
  6871.       Inc(X, (Width div 2) * 3);
  6872.     end;
  6873.     X := Width div 2;
  6874.     Inc(Y, (Height div 2) * 3);
  6875.   end;
  6876.   SetTextJustify(LeftText, TopText);
  6877.   WaitToGo;
  6878. end; { FillStylePlay }
  6879.  
  6880. procedure FillPatternPlay;
  6881. { Display some user defined fill patterns }
  6882. const
  6883.   Patterns : array[0..11] of FillPatternType = (
  6884.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  6885.             OldColor which has a path of pixels of OldColor or NewColor
  6886.             with sides touching back to the seed point, (XSeed, YSeed).
  6887.             Therefore, only pixels of OldColor are modified and no other
  6888.             information is changed.
  6889.  
  6890.             SEE ALSO
  6891.  
  6892.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  6893.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  6894.             SETVIEW
  6895.  
  6896.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  6897.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  6898.             IF WHICHVGA = 0 THEN STOP
  6899.             DUMMY=RES640
  6900.             SETVIEW 100, 100, 539, 379
  6901.             FILLVIEW 10
  6902.             WHILE INKEY$ = ""
  6903.             WEND
  6904.             VIDEOMODESET VMODE
  6905.             END
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.                                                                          63
  6923.  
  6924.  
  6925.  
  6926.  
  6927.  
  6928.  
  6929.           FONTGETINFO
  6930.  
  6931.             PROTOTYPE
  6932.  
  6933.             SUB FONTGETINFO (Width%, Height%)
  6934.  
  6935.             INPUT
  6936.  
  6937.             no input parameters
  6938.     WEND
  6939.             MOUSEEXIT
  6940.             VIDEOMODESET VMODE
  6941.             END
  6942.  
  6943.  
  6944.  
  6945.  
  6946.  
  6947.  
  6948.  
  6949.  
  6950.  
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.  
  6958.  
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.  
  6965.  
  6966.  
  6967.  
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.  
  6980.  
  6981.  
  6982.                                                                          86
  6983.  
  6984.  
  6985.  
  6986.  
  6987.  
  6988.  
  6989.           MOUSECURSORDEFAULT
  6990.  
  6991.             PROTOTYPE
  6992.  
  6993.             SUB MOUSECURSORDEFAULT ()
  6994.  
  6995.             INPUT
  6996.  
  6997.             no input parameters
  6998.  
  6999.             OUTPUT
  7000.  
  7001.             no value returned
  7002.  
  7003.             USAGE
  7004.  
  7005.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  7006.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  7007. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  7008. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  7009. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  7010. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  7011. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  7012. $╤
  7013. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  7014. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  7015. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  7016. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  7017. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  7018. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  7019. ░£▒
  7020. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  7021. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  7022.       end;
  7023.     end;
  7024.   end;
  7025.   WaitToGo;
  7026. end; { UserLineStylePlay }
  7027.  
  7028.  
  7029. procedure SayGoodbye;
  7030. { Say goodbye and then exit the program }
  7031. var
  7032.   ViewInfo : ViewPortType;
  7033. begin
  7034.   MainWindow('');
  7035.   GetViewSettings(ViewInfo);
  7036.   SetTextStyle(TriplexFont, HorizDir, 4);
  7037.   SetTextJustify(CenterText, CenterText);
  7038.   with ViewInfo do
  7039.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  7040.   StatusLine('Press any key to quit...');
  7041.   repeat until KeyPressed;
  7042. end; { SayGoodbye }
  7043.  
  7044.  
  7045. PROCEDURE SelectMode;
  7046. VAR
  7047.     choice1,choice2     : CHAR;
  7048.    xsize,ysize            : WORD;
  7049. BEGIN
  7050.     (* Let's select a mode *)
  7051.     ClrScr;
  7052.     WriteLn('VESADEMO:');
  7053.     WriteLn('1. 256 colors');
  7054.     WriteLn('2. 32768 colors');
  7055.     WriteLn('3. 65536 colors');
  7056.     WriteLn('4. 16777216 colors');
  7057.     WriteLn('Q uit');
  7058.     WriteLn;
  7059.     Write('Your choice: ');
  7060.     REPEAT
  7061.         ReadLn(choice1);
  7062.       IF choice1 <> '1' THEN BEGIN
  7063.           WriteLn('Sorry !');
  7064.          WriteLn('This demo wasn''t written for more as 256 colors !');
  7065.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  7066.          WriteLn('Switching to 256 colors.');
  7067.          choice1 := '1';
  7068.       END;
  7069.     UNTIL choice1 IN ['1'..'4','q'];
  7070.     IF choice1 = 'q' THEN Halt;
  7071.  
  7072.     WriteLn;
  7073.     WriteLn;
  7074.     WriteLn('a. 320x200');
  7075.     WriteLn('b. 640x480');
  7076.     WriteLn('c. 800x600');
  7077.     WriteLn('d. 1024x768');
  7078.     WriteLn('e. 1280x1024');
  7079.     WriteLn('Q uit');
  7080.     WriteLn;
  7081.     Write('Your choice: ');
  7082.     REPEAT
  7083.         ReadLn(choice2);
  7084.     UNTIL choice2 IN ['a'..'e','q'];
  7085.     IF choice2 = 'q' THEN Halt;
  7086.  
  7087.     CASE choice2 OF
  7088.         'a' : BEGIN
  7089.             xsize := 320;
  7090.             ysize := 200;
  7091.         END;
  7092.         'b' : BEGIN
  7093.             xsize := 640;
  7094.             ysize := 480;
  7095.         END;
  7096.         'c' : BEGIN
  7097.             xsize := 800;
  7098.             ysize := 600;
  7099.         END;
  7100.         'd' : BEGIN
  7101.             xsize := 1024;
  7102.             ysize := 768;
  7103.         END;
  7104.         'e' : BEGIN
  7105.             xsize := 1280;
  7106.             ysize := 1024;
  7107.         END;
  7108.     END;
  7109.     CASE choice1 OF
  7110.         '1' : mode := FindVesaMode(xsize,ysize,8);
  7111.         '2' : mode := FindVesaMode(xsize,ysize,15);
  7112.         '3' : mode := FindVesaMode(xsize,ysize,16);
  7113.         '4' : mode := FindVesaMode(xsize,ysize,24);
  7114.     END;
  7115.     IF mode = 0 THEN BEGIN
  7116.         WriteLn('No such mode could be found !');
  7117.         WriteLn('Switching to to 320x200.');
  7118.         ReadKey;
  7119.         mode := V320x200x256;
  7120.     END;
  7121. END;
  7122.  
  7123. begin { program body }
  7124.   SelectMode;
  7125.   Initialize;
  7126.   ReportStatus;
  7127.  
  7128. {  AspectRatioPlay; }
  7129.   FillEllipsePlay;
  7130.   SectorPlay;
  7131.   WriteModePlay;
  7132.  
  7133.   ColorPlay;
  7134.   { PalettePlay only intended to work on these drivers: }
  7135.   if (GraphDriver = EGA) or
  7136.       (GraphDriver = EGA64) or
  7137.       (GraphDriver = VGA) then
  7138.      PalettePlay;
  7139.   PutPixelPlay;
  7140. {  PutImagePlay; }
  7141.   RandBarPlay;
  7142.   BarPlay;
  7143.   Bar3DPlay;
  7144.   ArcPlay;
  7145.   CirclePlay;
  7146.   PiePlay;
  7147.   LineToPlay;
  7148.   LineRelPlay;
  7149. {  LineStylePlay; }
  7150. {  UserLineStylePlay; }
  7151.   TextDump;
  7152.   TextPlay;
  7153.   CrtModePlay;
  7154.   FillStylePlay;
  7155.   FillPatternPlay;
  7156.   PolyPlay;
  7157.   SayGoodbye;
  7158. {  CloseGraph; }
  7159.   CloseVesa;
  7160. end.
  7161. ***************************************************
  7162.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  7163.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  7164. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  7165. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  7166. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  7167. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  7168.     Color := RandColor;
  7169.     SetColor(Color);
  7170.     SetFillStyle(Random(CloseDotFill)+1, Color);
  7171.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  7172.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  7173.   until KeyPressed;
  7174.   WaitToGo;
  7175. end; { RandBarPlay }
  7176.  
  7177. procedure ArcPlay;
  7178. { Draw random arcs on the screen }
  7179. var
  7180.   MaxRadius : word;
  7181.   EndAngle : word;
  7182.   ArcInfo : ArcCoordsType;
  7183. begin
  7184.   MainWindow('Arc / GetArcCoords demonstration');
  7185.   StatusLine('Esc aborts or press a key');
  7186.   MaxRadius := MaxY div 10;
  7187.   repeat
  7188.     SetColor(RandColor);
  7189.     EndAngle := Random(360);
  7190.     SetLineStyle(SolidLn, 0, NormWidth);
  7191.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  7192.     GetArcCoords(ArcInfo);
  7193.     with ArcInfo do
  7194.     begin
  7195.       Line(X, Y, XStart, YStart);
  7196.       Line(X, Y, Xend, Yend);
  7197.     end;
  7198.   until KeyPressed;
  7199.   WaitToGo;
  7200. end; { ArcPlay }
  7201.  
  7202. procedure PutPixelPlay;
  7203. { Demonstrate the PutPixel and GetPixel commands }
  7204. const
  7205.   Seed   = 1962; { A seed for the random number generator }
  7206.   NumPts = 2000; { The number of pixels plotted }
  7207.   Esc    = #27;
  7208. var
  7209.   I : word;
  7210.   X, Y, Color : word;
  7211.   XMax, YMax  : integer;
  7212.   ViewInfo    : ViewPortType;
  7213. begin
  7214.   MainWindow('PutPixel / GetPixel demonstration');
  7215.   StatusLine('Esc aborts or press a key...');
  7216.  
  7217.   GetViewSettings(ViewInfo);
  7218.   with ViewInfo do
  7219.   begin
  7220.     XMax := (x2-x1-1);
  7221.     YMax := (y2-y1-1);
  7222.   end;
  7223.  
  7224.   while not KeyPressed do
  7225.   begin
  7226.     { Plot random pixels }
  7227.     RandSeed := Seed;
  7228.     I := 0;
  7229.     while (not KeyPressed) and (I < NumPts) do
  7230.     begin
  7231.       Inc(I);
  7232.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  7233.     end;
  7234.  
  7235.     { Erase pixels }
  7236.     RandSeed := Seed;
  7237.     I := 0;
  7238.     while (not KeyPressed) and (I < NumPts) do
  7239.     begin
  7240.       Inc(I);
  7241.       X := Random(XMax)+1;
  7242.       Y := Random(YMax)+1;
  7243.       Color := GetPixel(X, Y);
  7244.         if Color = RandColor then
  7245.           PutPixel(X, Y, 0);
  7246.      end;
  7247.   end;
  7248.   WaitToGo;
  7249. end; { PutPixelPlay }
  7250.  
  7251. procedure PutImagePlay;
  7252. { Demonstrate the GetImage and PutImage commands }
  7253.  
  7254. const
  7255.   r  = 20;
  7256.   StartX = 100;
  7257.   StartY = 50;
  7258.  
  7259. var
  7260.   CurPort : ViewPortType;
  7261.  
  7262. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  7263. var
  7264.   Step : integer;
  7265. begin
  7266.   Step := Random(2*r);
  7267.   if Odd(Step) then
  7268.     Step := -Step;
  7269.   X := X + Step;
  7270.   Step := Random(r);
  7271.   if Odd(Step) then
  7272.     Step := -Step;
  7273.   Y := Y + Step;
  7274.  
  7275.   { Make saucer bounce off viewport walls }
  7276.   with CurPort do
  7277.   begin
  7278.     if (x1 + X + Width - 1 > x2) then
  7279.       X := x2-x1 - Width + 1
  7280.     else
  7281.       if (X < 0) then
  7282.         X := 0;
  7283.     if (y1 + Y + Height - 1 > y2) then
  7284.       Y := y2-y1 - Height + 1
  7285.     else
  7286.       if (Y < 0) then
  7287.         Y := 0;
  7288.   end;
  7289. end; { MoveSaucer }
  7290.  
  7291. var
  7292.   Pausetime : word;
  7293.   Saucer    : pointer;
  7294.   X, Y      : integer;
  7295.   ulx, uly  : word;
  7296.   lrx, lry  : word;
  7297.   Size      : word;
  7298.   I         : word;
  7299. begin
  7300.   ClearDevice;
  7301.   FullPort;
  7302.  
  7303.   { PaintScreen }
  7304.   ClearDevice;
  7305.   MainWindow('GetImage / PutImage Demonstration');
  7306.   StatusLine('Esc aborts or press a key...');
  7307.   GetViewSettings(CurPort);
  7308.  
  7309.   { DrawSaucer }
  7310.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  7311.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  7312.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  7313.   Circle(StartX+10, StartY-12, 2);
  7314.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  7315.   Circle(StartX-10, StartY-12, 2);
  7316.   SetFillStyle(SolidFill, MaxColor);
  7317.   FloodFill(StartX+1, StartY+4, GetColor);
  7318.  
  7319.   { ReadSaucerImage }
  7320.   ulx := StartX-(r+1);
  7321.   uly := StartY-14;
  7322.   lrx := StartX+(r+1);
  7323.   lry := StartY+(r div 3)+3;
  7324.  
  7325.   Size := ImageSize(ulx, uly, lrx, lry);
  7326.   GetMem(Saucer, Size);
  7327.   GetImage(ulx, uly, lrx, lry, Saucer^);
  7328. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  7329.  
  7330.   { Plot some "stars" }
  7331.   for I := 1 to 1000 do
  7332.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  7333.   X := MaxX div 2;
  7334.   Y := MaxY div 2;
  7335.   PauseTime := 70;
  7336.  
  7337.   { Move the saucer around }
  7338.   repeat
  7339. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  7340.      Delay(PauseTime);
  7341. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  7342.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  7343.   until KeyPressed;
  7344.   FreeMem(Saucer, size);
  7345.   WaitToGo;
  7346. end; { PutImagePlay }
  7347.  
  7348. procedure PolyPlay;
  7349. { Draw random polygons with random fill styles on the screen }
  7350. const
  7351.   MaxPts = 5;
  7352. type
  7353.   PolygonType = array[1..MaxPts] of PointType;
  7354. var
  7355.   Poly : PolygonType;
  7356.   I, Color : word;
  7357. begin
  7358.   MainWindow('FillPoly demonstration');
  7359.   StatusLine('Esc aborts or press a key...');
  7360.   repeat
  7361.     Color := RandColor;
  7362.     SetFillStyle(Random(11)+1, Color);
  7363.     SetColor(Color);
  7364.     for I := 1 to MaxPts do
  7365.       with Poly[I] do
  7366.       begin
  7367.         X := Random(MaxX);
  7368.         Y := Random(MaxY);
  7369.       end;
  7370.     FillPoly(MaxPts, Poly);
  7371.   until KeyPressed;
  7372.   WaitToGo;
  7373. end; { PolyPlay }
  7374.  
  7375. procedure FillStylePlay;
  7376. { Display all of the predefined fill styles available }
  7377. var
  7378.   Style    : word;
  7379.   Width    : word;
  7380.   Height   : word;
  7381.   X, Y     : word;
  7382.   I, J     : word;
  7383.   ViewInfo : ViewPortType;
  7384.  
  7385. procedure DrawBox(X, Y : word);
  7386. begin
  7387.   SetFillStyle(Style, MaxColor);
  7388.   with ViewInfo do
  7389.     Bar(X, Y, X+Width, Y+Height);
  7390.   Rectangle(X, Y, X+Width, Y+Height);
  7391.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  7392.   Inc(Style);
  7393. end; { DrawBox }
  7394.  
  7395. begin
  7396.   MainWindow('Pre-defined fill styles');
  7397.   GetViewSettings(ViewInfo);
  7398.   with ViewInfo do
  7399.   begin
  7400.     Width := 2 * ((x2+1) div 13);
  7401.     Height := 2 * ((y2-10) div 10);
  7402.   end;
  7403.   X := Width div 2;
  7404.   Y := Height div 2;
  7405.   Style := 0;
  7406.   for J := 1 to 3 do
  7407.   begin
  7408.     for I := 1 to 4 do
  7409.     begin
  7410.       DrawBox(X, Y);
  7411.       Inc(X, (Width div 2) * 3);
  7412.     end;
  7413.     X := Width div 2;
  7414.     Inc(Y, (Height div 2) * 3);
  7415.   end;
  7416.   SetTextJustify(LeftText, TopText);
  7417.   WaitToGo;
  7418. end; { FillStylePlay }
  7419.  
  7420. procedure FillPatternPlay;
  7421. { Display some user defined fill patterns }
  7422. const
  7423.   Patterns : array[0..11] of FillPatternType = (
  7424.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  7425.             OldColor which has a path of pixels of OldColor or NewColor
  7426.             with sides touching back to the seed point, (XSeed, YSeed).
  7427.             Therefore, only pixels of OldColor are modified and no other
  7428.             information is changed.
  7429.  
  7430.             SEE ALSO
  7431.  
  7432.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  7433.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  7434.             SETVIEW
  7435.  
  7436.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  7437.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  7438.             IF WHICHVGA = 0 THEN STOP
  7439.             DUMMY=RES640
  7440.             SETVIEW 100, 100, 539, 379
  7441.             FILLVIEW 10
  7442.             WHILE INKEY$ = ""
  7443.             WEND
  7444.             VIDEOMODESET VMODE
  7445.             END
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.                                                                          63
  7463.  
  7464.  
  7465.  
  7466.  
  7467.  
  7468.  
  7469.           FONTGETINFO
  7470.  
  7471.             PROTOTYPE
  7472.  
  7473.             SUB FONTGETINFO (Width%, Height%)
  7474.  
  7475.             INPUT
  7476.  
  7477.             no input parameters
  7478.     WEND
  7479.             MOUSEEXIT
  7480.             VIDEOMODESET VMODE
  7481.             END
  7482.  
  7483.  
  7484.  
  7485.  
  7486.  
  7487.  
  7488.  
  7489.  
  7490.  
  7491.  
  7492.  
  7493.  
  7494.  
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.                                                                          86
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.           MOUSECURSORDEFAULT
  7530.  
  7531.             PROTOTYPE
  7532.  
  7533.             SUB MOUSECURSORDEFAULT ()
  7534.  
  7535.             INPUT
  7536.  
  7537.             no input parameters
  7538.  
  7539.             OUTPUT
  7540.  
  7541.             no value returned
  7542.  
  7543.             USAGE
  7544.  
  7545.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  7546.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  7547. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  7548. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  7549. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  7550. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  7551. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  7552. $╤
  7553. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  7554. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  7555. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  7556. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  7557. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  7558. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  7559. ░£▒
  7560. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  7561. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  7562.       end;
  7563.     end;
  7564.   end;
  7565.   WaitToGo;
  7566. end; { UserLineStylePlay }
  7567.  
  7568.  
  7569. procedure SayGoodbye;
  7570. { Say goodbye and then exit the program }
  7571. var
  7572.   ViewInfo : ViewPortType;
  7573. begin
  7574.   MainWindow('');
  7575.   GetViewSettings(ViewInfo);
  7576.   SetTextStyle(TriplexFont, HorizDir, 4);
  7577.   SetTextJustify(CenterText, CenterText);
  7578.   with ViewInfo do
  7579.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  7580.   StatusLine('Press any key to quit...');
  7581.   repeat until KeyPressed;
  7582. end; { SayGoodbye }
  7583.  
  7584.  
  7585. PROCEDURE SelectMode;
  7586. VAR
  7587.     choice1,choice2     : CHAR;
  7588.    xsize,ysize            : WORD;
  7589. BEGIN
  7590.     (* Let's select a mode *)
  7591.     ClrScr;
  7592.     WriteLn('VESADEMO:');
  7593.     WriteLn('1. 256 colors');
  7594.     WriteLn('2. 32768 colors');
  7595.     WriteLn('3. 65536 colors');
  7596.     WriteLn('4. 16777216 colors');
  7597.     WriteLn('Q uit');
  7598.     WriteLn;
  7599.     Write('Your choice: ');
  7600.     REPEAT
  7601.         ReadLn(choice1);
  7602.       IF choice1 <> '1' THEN BEGIN
  7603.           WriteLn('Sorry !');
  7604.          WriteLn('This demo wasn''t written for more as 256 colors !');
  7605.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  7606.          WriteLn('Switching to 256 colors.');
  7607.          choice1 := '1';
  7608.       END;
  7609.     UNTIL choice1 IN ['1'..'4','q'];
  7610.     IF choice1 = 'q' THEN Halt;
  7611.  
  7612.     WriteLn;
  7613.     WriteLn;
  7614.     WriteLn('a. 320x200');
  7615.     WriteLn('b. 640x480');
  7616.     WriteLn('c. 800x600');
  7617.     WriteLn('d. 1024x768');
  7618.     WriteLn('e. 1280x1024');
  7619.     WriteLn('Q uit');
  7620.     WriteLn;
  7621.     Write('Your choice: ');
  7622.     REPEAT
  7623.         ReadLn(choice2);
  7624.     UNTIL choice2 IN ['a'..'e','q'];
  7625.     IF choice2 = 'q' THEN Halt;
  7626.  
  7627.     CASE choice2 OF
  7628.         'a' : BEGIN
  7629.             xsize := 320;
  7630.             ysize := 200;
  7631.         END;
  7632.         'b' : BEGIN
  7633.             xsize := 640;
  7634.             ysize := 480;
  7635.         END;
  7636.         'c' : BEGIN
  7637.             xsize := 800;
  7638.             ysize := 600;
  7639.         END;
  7640.         'd' : BEGIN
  7641.             xsize := 1024;
  7642.             ysize := 768;
  7643.         END;
  7644.         'e' : BEGIN
  7645.             xsize := 1280;
  7646.             ysize := 1024;
  7647.         END;
  7648.     END;
  7649.     CASE choice1 OF
  7650.         '1' : mode := FindVesaMode(xsize,ysize,8);
  7651.         '2' : mode := FindVesaMode(xsize,ysize,15);
  7652.         '3' : mode := FindVesaMode(xsize,ysize,16);
  7653.         '4' : mode := FindVesaMode(xsize,ysize,24);
  7654.     END;
  7655.     IF mode = 0 THEN BEGIN
  7656.         WriteLn('No such mode could be found !');
  7657.         WriteLn('Switching to to 320x200.');
  7658.         ReadKey;
  7659.         mode := V320x200x256;
  7660.     END;
  7661. END;
  7662.  
  7663. begin { program body }
  7664.   SelectMode;
  7665.   Initialize;
  7666.   ReportStatus;
  7667.  
  7668. {  AspectRatioPlay; }
  7669.   FillEllipsePlay;
  7670.   SectorPlay;
  7671.   WriteModePlay;
  7672.  
  7673.   ColorPlay;
  7674.   { PalettePlay only intended to work on these drivers: }
  7675.   if (GraphDriver = EGA) or
  7676.       (GraphDriver = EGA64) or
  7677.       (GraphDriver = VGA) then
  7678.      PalettePlay;
  7679.   PutPixelPlay;
  7680. {  PutImagePlay; }
  7681.   RandBarPlay;
  7682.   BarPlay;
  7683.   Bar3DPlay;
  7684.   ArcPlay;
  7685.   CirclePlay;
  7686.   PiePlay;
  7687.   LineToPlay;
  7688.   LineRelPlay;
  7689. {  LineStylePlay; }
  7690. {  UserLineStylePlay; }
  7691.   TextDump;
  7692.   TextPlay;
  7693.   CrtModePlay;
  7694.   FillStylePlay;
  7695.   FillPatternPlay;
  7696.   PolyPlay;
  7697.   SayGoodbye;
  7698. {  CloseGraph; }
  7699.   CloseVesa;
  7700. end.
  7701. ***************************************************
  7702.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  7703.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  7704. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  7705. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  7706. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  7707. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  7708.     Color := RandColor;
  7709.     SetColor(Color);
  7710.     SetFillStyle(Random(CloseDotFill)+1, Color);
  7711.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  7712.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  7713.   until KeyPressed;
  7714.   WaitToGo;
  7715. end; { RandBarPlay }
  7716.  
  7717. procedure ArcPlay;
  7718. { Draw random arcs on the screen }
  7719. var
  7720.   MaxRadius : word;
  7721.   EndAngle : word;
  7722.   ArcInfo : ArcCoordsType;
  7723. begin
  7724.   MainWindow('Arc / GetArcCoords demonstration');
  7725.   StatusLine('Esc aborts or press a key');
  7726.   MaxRadius := MaxY div 10;
  7727.   repeat
  7728.     SetColor(RandColor);
  7729.     EndAngle := Random(360);
  7730.     SetLineStyle(SolidLn, 0, NormWidth);
  7731.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  7732.     GetArcCoords(ArcInfo);
  7733.     with ArcInfo do
  7734.     begin
  7735.       Line(X, Y, XStart, YStart);
  7736.       Line(X, Y, Xend, Yend);
  7737.     end;
  7738.   until KeyPressed;
  7739.   WaitToGo;
  7740. end; { ArcPlay }
  7741.  
  7742. procedure PutPixelPlay;
  7743. { Demonstrate the PutPixel and GetPixel commands }
  7744. const
  7745.   Seed   = 1962; { A seed for the random number generator }
  7746.   NumPts = 2000; { The number of pixels plotted }
  7747.   Esc    = #27;
  7748. var
  7749.   I : word;
  7750.   X, Y, Color : word;
  7751.   XMax, YMax  : integer;
  7752.   ViewInfo    : ViewPortType;
  7753. begin
  7754.   MainWindow('PutPixel / GetPixel demonstration');
  7755.   StatusLine('Esc aborts or press a key...');
  7756.  
  7757.   GetViewSettings(ViewInfo);
  7758.   with ViewInfo do
  7759.   begin
  7760.     XMax := (x2-x1-1);
  7761.     YMax := (y2-y1-1);
  7762.   end;
  7763.  
  7764.   while not KeyPressed do
  7765.   begin
  7766.     { Plot random pixels }
  7767.     RandSeed := Seed;
  7768.     I := 0;
  7769.     while (not KeyPressed) and (I < NumPts) do
  7770.     begin
  7771.       Inc(I);
  7772.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  7773.     end;
  7774.  
  7775.     { Erase pixels }
  7776.     RandSeed := Seed;
  7777.     I := 0;
  7778.     while (not KeyPressed) and (I < NumPts) do
  7779.     begin
  7780.       Inc(I);
  7781.       X := Random(XMax)+1;
  7782.       Y := Random(YMax)+1;
  7783.       Color := GetPixel(X, Y);
  7784.         if Color = RandColor then
  7785.           PutPixel(X, Y, 0);
  7786.      end;
  7787.   end;
  7788.   WaitToGo;
  7789. end; { PutPixelPlay }
  7790.  
  7791. procedure PutImagePlay;
  7792. { Demonstrate the GetImage and PutImage commands }
  7793.  
  7794. const
  7795.   r  = 20;
  7796.   StartX = 100;
  7797.   StartY = 50;
  7798.  
  7799. var
  7800.   CurPort : ViewPortType;
  7801.  
  7802. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  7803. var
  7804.   Step : integer;
  7805. begin
  7806.   Step := Random(2*r);
  7807.   if Odd(Step) then
  7808.     Step := -Step;
  7809.   X := X + Step;
  7810.   Step := Random(r);
  7811.   if Odd(Step) then
  7812.     Step := -Step;
  7813.   Y := Y + Step;
  7814.  
  7815.   { Make saucer bounce off viewport walls }
  7816.   with CurPort do
  7817.   begin
  7818.     if (x1 + X + Width - 1 > x2) then
  7819.       X := x2-x1 - Width + 1
  7820.     else
  7821.       if (X < 0) then
  7822.         X := 0;
  7823.     if (y1 + Y + Height - 1 > y2) then
  7824.       Y := y2-y1 - Height + 1
  7825.     else
  7826.       if (Y < 0) then
  7827.         Y := 0;
  7828.   end;
  7829. end; { MoveSaucer }
  7830.  
  7831. var
  7832.   Pausetime : word;
  7833.   Saucer    : pointer;
  7834.   X, Y      : integer;
  7835.   ulx, uly  : word;
  7836.   lrx, lry  : word;
  7837.   Size      : word;
  7838.   I         : word;
  7839. begin
  7840.   ClearDevice;
  7841.   FullPort;
  7842.  
  7843.   { PaintScreen }
  7844.   ClearDevice;
  7845.   MainWindow('GetImage / PutImage Demonstration');
  7846.   StatusLine('Esc aborts or press a key...');
  7847.   GetViewSettings(CurPort);
  7848.  
  7849.   { DrawSaucer }
  7850.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  7851.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  7852.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  7853.   Circle(StartX+10, StartY-12, 2);
  7854.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  7855.   Circle(StartX-10, StartY-12, 2);
  7856.   SetFillStyle(SolidFill, MaxColor);
  7857.   FloodFill(StartX+1, StartY+4, GetColor);
  7858.  
  7859.   { ReadSaucerImage }
  7860.   ulx := StartX-(r+1);
  7861.   uly := StartY-14;
  7862.   lrx := StartX+(r+1);
  7863.   lry := StartY+(r div 3)+3;
  7864.  
  7865.   Size := ImageSize(ulx, uly, lrx, lry);
  7866.   GetMem(Saucer, Size);
  7867.   GetImage(ulx, uly, lrx, lry, Saucer^);
  7868. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  7869.  
  7870.   { Plot some "stars" }
  7871.   for I := 1 to 1000 do
  7872.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  7873.   X := MaxX div 2;
  7874.   Y := MaxY div 2;
  7875.   PauseTime := 70;
  7876.  
  7877.   { Move the saucer around }
  7878.   repeat
  7879. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  7880.      Delay(PauseTime);
  7881. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  7882.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  7883.   until KeyPressed;
  7884.   FreeMem(Saucer, size);
  7885.   WaitToGo;
  7886. end; { PutImagePlay }
  7887.  
  7888. procedure PolyPlay;
  7889. { Draw random polygons with random fill styles on the screen }
  7890. const
  7891.   MaxPts = 5;
  7892. type
  7893.   PolygonType = array[1..MaxPts] of PointType;
  7894. var
  7895.   Poly : PolygonType;
  7896.   I, Color : word;
  7897. begin
  7898.   MainWindow('FillPoly demonstration');
  7899.   StatusLine('Esc aborts or press a key...');
  7900.   repeat
  7901.     Color := RandColor;
  7902.     SetFillStyle(Random(11)+1, Color);
  7903.     SetColor(Color);
  7904.     for I := 1 to MaxPts do
  7905.       with Poly[I] do
  7906.       begin
  7907.         X := Random(MaxX);
  7908.         Y := Random(MaxY);
  7909.       end;
  7910.     FillPoly(MaxPts, Poly);
  7911.   until KeyPressed;
  7912.   WaitToGo;
  7913. end; { PolyPlay }
  7914.  
  7915. procedure FillStylePlay;
  7916. { Display all of the predefined fill styles available }
  7917. var
  7918.   Style    : word;
  7919.   Width    : word;
  7920.   Height   : word;
  7921.   X, Y     : word;
  7922.   I, J     : word;
  7923.   ViewInfo : ViewPortType;
  7924.  
  7925. procedure DrawBox(X, Y : word);
  7926. begin
  7927.   SetFillStyle(Style, MaxColor);
  7928.   with ViewInfo do
  7929.     Bar(X, Y, X+Width, Y+Height);
  7930.   Rectangle(X, Y, X+Width, Y+Height);
  7931.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  7932.   Inc(Style);
  7933. end; { DrawBox }
  7934.  
  7935. begin
  7936.   MainWindow('Pre-defined fill styles');
  7937.   GetViewSettings(ViewInfo);
  7938.   with ViewInfo do
  7939.   begin
  7940.     Width := 2 * ((x2+1) div 13);
  7941.     Height := 2 * ((y2-10) div 10);
  7942.   end;
  7943.   X := Width div 2;
  7944.   Y := Height div 2;
  7945.   Style := 0;
  7946.   for J := 1 to 3 do
  7947.   begin
  7948.     for I := 1 to 4 do
  7949.     begin
  7950.       DrawBox(X, Y);
  7951.       Inc(X, (Width div 2) * 3);
  7952.     end;
  7953.     X := Width div 2;
  7954.     Inc(Y, (Height div 2) * 3);
  7955.   end;
  7956.   SetTextJustify(LeftText, TopText);
  7957.   WaitToGo;
  7958. end; { FillStylePlay }
  7959.  
  7960. procedure FillPatternPlay;
  7961. { Display some user defined fill patterns }
  7962. const
  7963.   Patterns : array[0..11] of FillPatternType = (
  7964.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  7965.             OldColor which has a path of pixels of OldColor or NewColor
  7966.             with sides touching back to the seed point, (XSeed, YSeed).
  7967.             Therefore, only pixels of OldColor are modified and no other
  7968.             information is changed.
  7969.  
  7970.             SEE ALSO
  7971.  
  7972.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  7973.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  7974.             SETVIEW
  7975.  
  7976.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  7977.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  7978.             IF WHICHVGA = 0 THEN STOP
  7979.             DUMMY=RES640
  7980.             SETVIEW 100, 100, 539, 379
  7981.             FILLVIEW 10
  7982.             WHILE INKEY$ = ""
  7983.             WEND
  7984.             VIDEOMODESET VMODE
  7985.             END
  7986.  
  7987.  
  7988.  
  7989.  
  7990.  
  7991.  
  7992.  
  7993.  
  7994.  
  7995.  
  7996.  
  7997.  
  7998.  
  7999.  
  8000.  
  8001.  
  8002.                                                                          63
  8003.  
  8004.  
  8005.  
  8006.  
  8007.  
  8008.  
  8009.           FONTGETINFO
  8010.  
  8011.             PROTOTYPE
  8012.  
  8013.             SUB FONTGETINFO (Width%, Height%)
  8014.  
  8015.             INPUT
  8016.  
  8017.             no input parameters
  8018.     WEND
  8019.             MOUSEEXIT
  8020.             VIDEOMODESET VMODE
  8021.             END
  8022.  
  8023.  
  8024.  
  8025.  
  8026.  
  8027.  
  8028.  
  8029.  
  8030.  
  8031.  
  8032.  
  8033.  
  8034.  
  8035.  
  8036.  
  8037.  
  8038.  
  8039.  
  8040.  
  8041.  
  8042.  
  8043.  
  8044.  
  8045.  
  8046.  
  8047.  
  8048.  
  8049.  
  8050.  
  8051.  
  8052.  
  8053.  
  8054.  
  8055.  
  8056.  
  8057.  
  8058.  
  8059.  
  8060.  
  8061.  
  8062.                                                                          86
  8063.  
  8064.  
  8065.  
  8066.  
  8067.  
  8068.  
  8069.           MOUSECURSORDEFAULT
  8070.  
  8071.             PROTOTYPE
  8072.  
  8073.             SUB MOUSECURSORDEFAULT ()
  8074.  
  8075.             INPUT
  8076.  
  8077.             no input parameters
  8078.  
  8079.             OUTPUT
  8080.  
  8081.             no value returned
  8082.  
  8083.             USAGE
  8084.  
  8085.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  8086.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  8087. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  8088. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  8089. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  8090. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  8091. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  8092. $╤
  8093. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  8094. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  8095. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  8096. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  8097. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  8098. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  8099. ░£▒
  8100. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  8101. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  8102.       end;
  8103.     end;
  8104.   end;
  8105.   WaitToGo;
  8106. end; { UserLineStylePlay }
  8107.  
  8108.  
  8109. procedure SayGoodbye;
  8110. { Say goodbye and then exit the program }
  8111. var
  8112.   ViewInfo : ViewPortType;
  8113. begin
  8114.   MainWindow('');
  8115.   GetViewSettings(ViewInfo);
  8116.   SetTextStyle(TriplexFont, HorizDir, 4);
  8117.   SetTextJustify(CenterText, CenterText);
  8118.   with ViewInfo do
  8119.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  8120.   StatusLine('Press any key to quit...');
  8121.   repeat until KeyPressed;
  8122. end; { SayGoodbye }
  8123.  
  8124.  
  8125. PROCEDURE SelectMode;
  8126. VAR
  8127.     choice1,choice2     : CHAR;
  8128.    xsize,ysize            : WORD;
  8129. BEGIN
  8130.     (* Let's select a mode *)
  8131.     ClrScr;
  8132.     WriteLn('VESADEMO:');
  8133.     WriteLn('1. 256 colors');
  8134.     WriteLn('2. 32768 colors');
  8135.     WriteLn('3. 65536 colors');
  8136.     WriteLn('4. 16777216 colors');
  8137.     WriteLn('Q uit');
  8138.     WriteLn;
  8139.     Write('Your choice: ');
  8140.     REPEAT
  8141.         ReadLn(choice1);
  8142.       IF choice1 <> '1' THEN BEGIN
  8143.           WriteLn('Sorry !');
  8144.          WriteLn('This demo wasn''t written for more as 256 colors !');
  8145.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  8146.          WriteLn('Switching to 256 colors.');
  8147.          choice1 := '1';
  8148.       END;
  8149.     UNTIL choice1 IN ['1'..'4','q'];
  8150.     IF choice1 = 'q' THEN Halt;
  8151.  
  8152.     WriteLn;
  8153.     WriteLn;
  8154.     WriteLn('a. 320x200');
  8155.     WriteLn('b. 640x480');
  8156.     WriteLn('c. 800x600');
  8157.     WriteLn('d. 1024x768');
  8158.     WriteLn('e. 1280x1024');
  8159.     WriteLn('Q uit');
  8160.     WriteLn;
  8161.     Write('Your choice: ');
  8162.     REPEAT
  8163.         ReadLn(choice2);
  8164.     UNTIL choice2 IN ['a'..'e','q'];
  8165.     IF choice2 = 'q' THEN Halt;
  8166.  
  8167.     CASE choice2 OF
  8168.         'a' : BEGIN
  8169.             xsize := 320;
  8170.             ysize := 200;
  8171.         END;
  8172.         'b' : BEGIN
  8173.             xsize := 640;
  8174.             ysize := 480;
  8175.         END;
  8176.         'c' : BEGIN
  8177.             xsize := 800;
  8178.             ysize := 600;
  8179.         END;
  8180.         'd' : BEGIN
  8181.             xsize := 1024;
  8182.             ysize := 768;
  8183.         END;
  8184.         'e' : BEGIN
  8185.             xsize := 1280;
  8186.             ysize := 1024;
  8187.         END;
  8188.     END;
  8189.     CASE choice1 OF
  8190.         '1' : mode := FindVesaMode(xsize,ysize,8);
  8191.         '2' : mode := FindVesaMode(xsize,ysize,15);
  8192.         '3' : mode := FindVesaMode(xsize,ysize,16);
  8193.         '4' : mode := FindVesaMode(xsize,ysize,24);
  8194.     END;
  8195.     IF mode = 0 THEN BEGIN
  8196.         WriteLn('No such mode could be found !');
  8197.         WriteLn('Switching to to 320x200.');
  8198.         ReadKey;
  8199.         mode := V320x200x256;
  8200.     END;
  8201. END;
  8202.  
  8203. begin { program body }
  8204.   SelectMode;
  8205.   Initialize;
  8206.   ReportStatus;
  8207.  
  8208. {  AspectRatioPlay; }
  8209.   FillEllipsePlay;
  8210.   SectorPlay;
  8211.   WriteModePlay;
  8212.  
  8213.   ColorPlay;
  8214.   { PalettePlay only intended to work on these drivers: }
  8215.   if (GraphDriver = EGA) or
  8216.       (GraphDriver = EGA64) or
  8217.       (GraphDriver = VGA) then
  8218.      PalettePlay;
  8219.   PutPixelPlay;
  8220. {  PutImagePlay; }
  8221.   RandBarPlay;
  8222.   BarPlay;
  8223.   Bar3DPlay;
  8224.   ArcPlay;
  8225.   CirclePlay;
  8226.   PiePlay;
  8227.   LineToPlay;
  8228.   LineRelPlay;
  8229. {  LineStylePlay; }
  8230. {  UserLineStylePlay; }
  8231.   TextDump;
  8232.   TextPlay;
  8233.   CrtModePlay;
  8234.   FillStylePlay;
  8235.   FillPatternPlay;
  8236.   PolyPlay;
  8237.   SayGoodbye;
  8238. {  CloseGraph; }
  8239.   CloseVesa;
  8240. end.
  8241. ***************************************************
  8242.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  8243.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  8244. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  8245. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  8246. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  8247. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  8248.     Color := RandColor;
  8249.     SetColor(Color);
  8250.     SetFillStyle(Random(CloseDotFill)+1, Color);
  8251.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  8252.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  8253.   until KeyPressed;
  8254.   WaitToGo;
  8255. end; { RandBarPlay }
  8256.  
  8257. procedure ArcPlay;
  8258. { Draw random arcs on the screen }
  8259. var
  8260.   MaxRadius : word;
  8261.   EndAngle : word;
  8262.   ArcInfo : ArcCoordsType;
  8263. begin
  8264.   MainWindow('Arc / GetArcCoords demonstration');
  8265.   StatusLine('Esc aborts or press a key');
  8266.   MaxRadius := MaxY div 10;
  8267.   repeat
  8268.     SetColor(RandColor);
  8269.     EndAngle := Random(360);
  8270.     SetLineStyle(SolidLn, 0, NormWidth);
  8271.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  8272.     GetArcCoords(ArcInfo);
  8273.     with ArcInfo do
  8274.     begin
  8275.       Line(X, Y, XStart, YStart);
  8276.       Line(X, Y, Xend, Yend);
  8277.     end;
  8278.   until KeyPressed;
  8279.   WaitToGo;
  8280. end; { ArcPlay }
  8281.  
  8282. procedure PutPixelPlay;
  8283. { Demonstrate the PutPixel and GetPixel commands }
  8284. const
  8285.   Seed   = 1962; { A seed for the random number generator }
  8286.   NumPts = 2000; { The number of pixels plotted }
  8287.   Esc    = #27;
  8288. var
  8289.   I : word;
  8290.   X, Y, Color : word;
  8291.   XMax, YMax  : integer;
  8292.   ViewInfo    : ViewPortType;
  8293. begin
  8294.   MainWindow('PutPixel / GetPixel demonstration');
  8295.   StatusLine('Esc aborts or press a key...');
  8296.  
  8297.   GetViewSettings(ViewInfo);
  8298.   with ViewInfo do
  8299.   begin
  8300.     XMax := (x2-x1-1);
  8301.     YMax := (y2-y1-1);
  8302.   end;
  8303.  
  8304.   while not KeyPressed do
  8305.   begin
  8306.     { Plot random pixels }
  8307.     RandSeed := Seed;
  8308.     I := 0;
  8309.     while (not KeyPressed) and (I < NumPts) do
  8310.     begin
  8311.       Inc(I);
  8312.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  8313.     end;
  8314.  
  8315.     { Erase pixels }
  8316.     RandSeed := Seed;
  8317.     I := 0;
  8318.     while (not KeyPressed) and (I < NumPts) do
  8319.     begin
  8320.       Inc(I);
  8321.       X := Random(XMax)+1;
  8322.       Y := Random(YMax)+1;
  8323.       Color := GetPixel(X, Y);
  8324.         if Color = RandColor then
  8325.           PutPixel(X, Y, 0);
  8326.      end;
  8327.   end;
  8328.   WaitToGo;
  8329. end; { PutPixelPlay }
  8330.  
  8331. procedure PutImagePlay;
  8332. { Demonstrate the GetImage and PutImage commands }
  8333.  
  8334. const
  8335.   r  = 20;
  8336.   StartX = 100;
  8337.   StartY = 50;
  8338.  
  8339. var
  8340.   CurPort : ViewPortType;
  8341.  
  8342. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  8343. var
  8344.   Step : integer;
  8345. begin
  8346.   Step := Random(2*r);
  8347.   if Odd(Step) then
  8348.     Step := -Step;
  8349.   X := X + Step;
  8350.   Step := Random(r);
  8351.   if Odd(Step) then
  8352.     Step := -Step;
  8353.   Y := Y + Step;
  8354.  
  8355.   { Make saucer bounce off viewport walls }
  8356.   with CurPort do
  8357.   begin
  8358.     if (x1 + X + Width - 1 > x2) then
  8359.       X := x2-x1 - Width + 1
  8360.     else
  8361.       if (X < 0) then
  8362.         X := 0;
  8363.     if (y1 + Y + Height - 1 > y2) then
  8364.       Y := y2-y1 - Height + 1
  8365.     else
  8366.       if (Y < 0) then
  8367.         Y := 0;
  8368.   end;
  8369. end; { MoveSaucer }
  8370.  
  8371. var
  8372.   Pausetime : word;
  8373.   Saucer    : pointer;
  8374.   X, Y      : integer;
  8375.   ulx, uly  : word;
  8376.   lrx, lry  : word;
  8377.   Size      : word;
  8378.   I         : word;
  8379. begin
  8380.   ClearDevice;
  8381.   FullPort;
  8382.  
  8383.   { PaintScreen }
  8384.   ClearDevice;
  8385.   MainWindow('GetImage / PutImage Demonstration');
  8386.   StatusLine('Esc aborts or press a key...');
  8387.   GetViewSettings(CurPort);
  8388.  
  8389.   { DrawSaucer }
  8390.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  8391.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  8392.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  8393.   Circle(StartX+10, StartY-12, 2);
  8394.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  8395.   Circle(StartX-10, StartY-12, 2);
  8396.   SetFillStyle(SolidFill, MaxColor);
  8397.   FloodFill(StartX+1, StartY+4, GetColor);
  8398.  
  8399.   { ReadSaucerImage }
  8400.   ulx := StartX-(r+1);
  8401.   uly := StartY-14;
  8402.   lrx := StartX+(r+1);
  8403.   lry := StartY+(r div 3)+3;
  8404.  
  8405.   Size := ImageSize(ulx, uly, lrx, lry);
  8406.   GetMem(Saucer, Size);
  8407.   GetImage(ulx, uly, lrx, lry, Saucer^);
  8408. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  8409.  
  8410.   { Plot some "stars" }
  8411.   for I := 1 to 1000 do
  8412.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  8413.   X := MaxX div 2;
  8414.   Y := MaxY div 2;
  8415.   PauseTime := 70;
  8416.  
  8417.   { Move the saucer around }
  8418.   repeat
  8419. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  8420.      Delay(PauseTime);
  8421. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  8422.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  8423.   until KeyPressed;
  8424.   FreeMem(Saucer, size);
  8425.   WaitToGo;
  8426. end; { PutImagePlay }
  8427.  
  8428. procedure PolyPlay;
  8429. { Draw random polygons with random fill styles on the screen }
  8430. const
  8431.   MaxPts = 5;
  8432. type
  8433.   PolygonType = array[1..MaxPts] of PointType;
  8434. var
  8435.   Poly : PolygonType;
  8436.   I, Color : word;
  8437. begin
  8438.   MainWindow('FillPoly demonstration');
  8439.   StatusLine('Esc aborts or press a key...');
  8440.   repeat
  8441.     Color := RandColor;
  8442.     SetFillStyle(Random(11)+1, Color);
  8443.     SetColor(Color);
  8444.     for I := 1 to MaxPts do
  8445.       with Poly[I] do
  8446.       begin
  8447.         X := Random(MaxX);
  8448.         Y := Random(MaxY);
  8449.       end;
  8450.     FillPoly(MaxPts, Poly);
  8451.   until KeyPressed;
  8452.   WaitToGo;
  8453. end; { PolyPlay }
  8454.  
  8455. procedure FillStylePlay;
  8456. { Display all of the predefined fill styles available }
  8457. var
  8458.   Style    : word;
  8459.   Width    : word;
  8460.   Height   : word;
  8461.   X, Y     : word;
  8462.   I, J     : word;
  8463.   ViewInfo : ViewPortType;
  8464.  
  8465. procedure DrawBox(X, Y : word);
  8466. begin
  8467.   SetFillStyle(Style, MaxColor);
  8468.   with ViewInfo do
  8469.     Bar(X, Y, X+Width, Y+Height);
  8470.   Rectangle(X, Y, X+Width, Y+Height);
  8471.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  8472.   Inc(Style);
  8473. end; { DrawBox }
  8474.  
  8475. begin
  8476.   MainWindow('Pre-defined fill styles');
  8477.   GetViewSettings(ViewInfo);
  8478.   with ViewInfo do
  8479.   begin
  8480.     Width := 2 * ((x2+1) div 13);
  8481.     Height := 2 * ((y2-10) div 10);
  8482.   end;
  8483.   X := Width div 2;
  8484.   Y := Height div 2;
  8485.   Style := 0;
  8486.   for J := 1 to 3 do
  8487.   begin
  8488.     for I := 1 to 4 do
  8489.     begin
  8490.       DrawBox(X, Y);
  8491.       Inc(X, (Width div 2) * 3);
  8492.     end;
  8493.     X := Width div 2;
  8494.     Inc(Y, (Height div 2) * 3);
  8495.   end;
  8496.   SetTextJustify(LeftText, TopText);
  8497.   WaitToGo;
  8498. end; { FillStylePlay }
  8499.  
  8500. procedure FillPatternPlay;
  8501. { Display some user defined fill patterns }
  8502. const
  8503.   Patterns : array[0..11] of FillPatternType = (
  8504.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  8505.             OldColor which has a path of pixels of OldColor or NewColor
  8506.             with sides touching back to the seed point, (XSeed, YSeed).
  8507.             Therefore, only pixels of OldColor are modified and no other
  8508.             information is changed.
  8509.  
  8510.             SEE ALSO
  8511.  
  8512.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  8513.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  8514.             SETVIEW
  8515.  
  8516.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  8517.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  8518.             IF WHICHVGA = 0 THEN STOP
  8519.             DUMMY=RES640
  8520.             SETVIEW 100, 100, 539, 379
  8521.             FILLVIEW 10
  8522.             WHILE INKEY$ = ""
  8523.             WEND
  8524.             VIDEOMODESET VMODE
  8525.             END
  8526.  
  8527.  
  8528.  
  8529.  
  8530.  
  8531.  
  8532.  
  8533.  
  8534.  
  8535.  
  8536.  
  8537.  
  8538.  
  8539.  
  8540.  
  8541.  
  8542.                                                                          63
  8543.  
  8544.  
  8545.  
  8546.  
  8547.  
  8548.  
  8549.           FONTGETINFO
  8550.  
  8551.             PROTOTYPE
  8552.  
  8553.             SUB FONTGETINFO (Width%, Height%)
  8554.  
  8555.             INPUT
  8556.  
  8557.             no input parameters
  8558.     WEND
  8559.             MOUSEEXIT
  8560.             VIDEOMODESET VMODE
  8561.             END
  8562.  
  8563.  
  8564.  
  8565.  
  8566.  
  8567.  
  8568.  
  8569.  
  8570.  
  8571.  
  8572.  
  8573.  
  8574.  
  8575.  
  8576.  
  8577.  
  8578.  
  8579.  
  8580.  
  8581.  
  8582.  
  8583.  
  8584.  
  8585.  
  8586.  
  8587.  
  8588.  
  8589.  
  8590.  
  8591.  
  8592.  
  8593.  
  8594.  
  8595.  
  8596.  
  8597.  
  8598.  
  8599.  
  8600.  
  8601.  
  8602.                                                                          86
  8603.  
  8604.  
  8605.  
  8606.  
  8607.  
  8608.  
  8609.           MOUSECURSORDEFAULT
  8610.  
  8611.             PROTOTYPE
  8612.  
  8613.             SUB MOUSECURSORDEFAULT ()
  8614.  
  8615.             INPUT
  8616.  
  8617.             no input parameters
  8618.  
  8619.             OUTPUT
  8620.  
  8621.             no value returned
  8622.  
  8623.             USAGE
  8624.  
  8625.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  8626.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  8627. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  8628. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  8629. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  8630. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  8631. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  8632. $╤
  8633. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  8634. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  8635. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  8636. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  8637. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  8638. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  8639. ░£▒
  8640. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  8641. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  8642.       end;
  8643.     end;
  8644.   end;
  8645.   WaitToGo;
  8646. end; { UserLineStylePlay }
  8647.  
  8648.  
  8649. procedure SayGoodbye;
  8650. { Say goodbye and then exit the program }
  8651. var
  8652.   ViewInfo : ViewPortType;
  8653. begin
  8654.   MainWindow('');
  8655.   GetViewSettings(ViewInfo);
  8656.   SetTextStyle(TriplexFont, HorizDir, 4);
  8657.   SetTextJustify(CenterText, CenterText);
  8658.   with ViewInfo do
  8659.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  8660.   StatusLine('Press any key to quit...');
  8661.   repeat until KeyPressed;
  8662. end; { SayGoodbye }
  8663.  
  8664.  
  8665. PROCEDURE SelectMode;
  8666. VAR
  8667.     choice1,choice2     : CHAR;
  8668.    xsize,ysize            : WORD;
  8669. BEGIN
  8670.     (* Let's select a mode *)
  8671.     ClrScr;
  8672.     WriteLn('VESADEMO:');
  8673.     WriteLn('1. 256 colors');
  8674.     WriteLn('2. 32768 colors');
  8675.     WriteLn('3. 65536 colors');
  8676.     WriteLn('4. 16777216 colors');
  8677.     WriteLn('Q uit');
  8678.     WriteLn;
  8679.     Write('Your choice: ');
  8680.     REPEAT
  8681.         ReadLn(choice1);
  8682.       IF choice1 <> '1' THEN BEGIN
  8683.           WriteLn('Sorry !');
  8684.          WriteLn('This demo wasn''t written for more as 256 colors !');
  8685.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  8686.          WriteLn('Switching to 256 colors.');
  8687.          choice1 := '1';
  8688.       END;
  8689.     UNTIL choice1 IN ['1'..'4','q'];
  8690.     IF choice1 = 'q' THEN Halt;
  8691.  
  8692.     WriteLn;
  8693.     WriteLn;
  8694.     WriteLn('a. 320x200');
  8695.     WriteLn('b. 640x480');
  8696.     WriteLn('c. 800x600');
  8697.     WriteLn('d. 1024x768');
  8698.     WriteLn('e. 1280x1024');
  8699.     WriteLn('Q uit');
  8700.     WriteLn;
  8701.     Write('Your choice: ');
  8702.     REPEAT
  8703.         ReadLn(choice2);
  8704.     UNTIL choice2 IN ['a'..'e','q'];
  8705.     IF choice2 = 'q' THEN Halt;
  8706.  
  8707.     CASE choice2 OF
  8708.         'a' : BEGIN
  8709.             xsize := 320;
  8710.             ysize := 200;
  8711.         END;
  8712.         'b' : BEGIN
  8713.             xsize := 640;
  8714.             ysize := 480;
  8715.         END;
  8716.         'c' : BEGIN
  8717.             xsize := 800;
  8718.             ysize := 600;
  8719.         END;
  8720.         'd' : BEGIN
  8721.             xsize := 1024;
  8722.             ysize := 768;
  8723.         END;
  8724.         'e' : BEGIN
  8725.             xsize := 1280;
  8726.             ysize := 1024;
  8727.         END;
  8728.     END;
  8729.     CASE choice1 OF
  8730.         '1' : mode := FindVesaMode(xsize,ysize,8);
  8731.         '2' : mode := FindVesaMode(xsize,ysize,15);
  8732.         '3' : mode := FindVesaMode(xsize,ysize,16);
  8733.         '4' : mode := FindVesaMode(xsize,ysize,24);
  8734.     END;
  8735.     IF mode = 0 THEN BEGIN
  8736.         WriteLn('No such mode could be found !');
  8737.         WriteLn('Switching to to 320x200.');
  8738.         ReadKey;
  8739.         mode := V320x200x256;
  8740.     END;
  8741. END;
  8742.  
  8743. begin { program body }
  8744.   SelectMode;
  8745.   Initialize;
  8746.   ReportStatus;
  8747.  
  8748. {  AspectRatioPlay; }
  8749.   FillEllipsePlay;
  8750.   SectorPlay;
  8751.   WriteModePlay;
  8752.  
  8753.   ColorPlay;
  8754.   { PalettePlay only intended to work on these drivers: }
  8755.   if (GraphDriver = EGA) or
  8756.       (GraphDriver = EGA64) or
  8757.       (GraphDriver = VGA) then
  8758.      PalettePlay;
  8759.   PutPixelPlay;
  8760. {  PutImagePlay; }
  8761.   RandBarPlay;
  8762.   BarPlay;
  8763.   Bar3DPlay;
  8764.   ArcPlay;
  8765.   CirclePlay;
  8766.   PiePlay;
  8767.   LineToPlay;
  8768.   LineRelPlay;
  8769. {  LineStylePlay; }
  8770. {  UserLineStylePlay; }
  8771.   TextDump;
  8772.   TextPlay;
  8773.   CrtModePlay;
  8774.   FillStylePlay;
  8775.   FillPatternPlay;
  8776.   PolyPlay;
  8777.   SayGoodbye;
  8778. {  CloseGraph; }
  8779.   CloseVesa;
  8780. end.
  8781. ***************************************************
  8782.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  8783.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  8784. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  8785. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  8786. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  8787. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  8788.     Color := RandColor;
  8789.     SetColor(Color);
  8790.     SetFillStyle(Random(CloseDotFill)+1, Color);
  8791.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  8792.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  8793.   until KeyPressed;
  8794.   WaitToGo;
  8795. end; { RandBarPlay }
  8796.  
  8797. procedure ArcPlay;
  8798. { Draw random arcs on the screen }
  8799. var
  8800.   MaxRadius : word;
  8801.   EndAngle : word;
  8802.   ArcInfo : ArcCoordsType;
  8803. begin
  8804.   MainWindow('Arc / GetArcCoords demonstration');
  8805.   StatusLine('Esc aborts or press a key');
  8806.   MaxRadius := MaxY div 10;
  8807.   repeat
  8808.     SetColor(RandColor);
  8809.     EndAngle := Random(360);
  8810.     SetLineStyle(SolidLn, 0, NormWidth);
  8811.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  8812.     GetArcCoords(ArcInfo);
  8813.     with ArcInfo do
  8814.     begin
  8815.       Line(X, Y, XStart, YStart);
  8816.       Line(X, Y, Xend, Yend);
  8817.     end;
  8818.   until KeyPressed;
  8819.   WaitToGo;
  8820. end; { ArcPlay }
  8821.  
  8822. procedure PutPixelPlay;
  8823. { Demonstrate the PutPixel and GetPixel commands }
  8824. const
  8825.   Seed   = 1962; { A seed for the random number generator }
  8826.   NumPts = 2000; { The number of pixels plotted }
  8827.   Esc    = #27;
  8828. var
  8829.   I : word;
  8830.   X, Y, Color : word;
  8831.   XMax, YMax  : integer;
  8832.   ViewInfo    : ViewPortType;
  8833. begin
  8834.   MainWindow('PutPixel / GetPixel demonstration');
  8835.   StatusLine('Esc aborts or press a key...');
  8836.  
  8837.   GetViewSettings(ViewInfo);
  8838.   with ViewInfo do
  8839.   begin
  8840.     XMax := (x2-x1-1);
  8841.     YMax := (y2-y1-1);
  8842.   end;
  8843.  
  8844.   while not KeyPressed do
  8845.   begin
  8846.     { Plot random pixels }
  8847.     RandSeed := Seed;
  8848.     I := 0;
  8849.     while (not KeyPressed) and (I < NumPts) do
  8850.     begin
  8851.       Inc(I);
  8852.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  8853.     end;
  8854.  
  8855.     { Erase pixels }
  8856.     RandSeed := Seed;
  8857.     I := 0;
  8858.     while (not KeyPressed) and (I < NumPts) do
  8859.     begin
  8860.       Inc(I);
  8861.       X := Random(XMax)+1;
  8862.       Y := Random(YMax)+1;
  8863.       Color := GetPixel(X, Y);
  8864.         if Color = RandColor then
  8865.           PutPixel(X, Y, 0);
  8866.      end;
  8867.   end;
  8868.   WaitToGo;
  8869. end; { PutPixelPlay }
  8870.  
  8871. procedure PutImagePlay;
  8872. { Demonstrate the GetImage and PutImage commands }
  8873.  
  8874. const
  8875.   r  = 20;
  8876.   StartX = 100;
  8877.   StartY = 50;
  8878.  
  8879. var
  8880.   CurPort : ViewPortType;
  8881.  
  8882. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  8883. var
  8884.   Step : integer;
  8885. begin
  8886.   Step := Random(2*r);
  8887.   if Odd(Step) then
  8888.     Step := -Step;
  8889.   X := X + Step;
  8890.   Step := Random(r);
  8891.   if Odd(Step) then
  8892.     Step := -Step;
  8893.   Y := Y + Step;
  8894.  
  8895.   { Make saucer bounce off viewport walls }
  8896.   with CurPort do
  8897.   begin
  8898.     if (x1 + X + Width - 1 > x2) then
  8899.       X := x2-x1 - Width + 1
  8900.     else
  8901.       if (X < 0) then
  8902.         X := 0;
  8903.     if (y1 + Y + Height - 1 > y2) then
  8904.       Y := y2-y1 - Height + 1
  8905.     else
  8906.       if (Y < 0) then
  8907.         Y := 0;
  8908.   end;
  8909. end; { MoveSaucer }
  8910.  
  8911. var
  8912.   Pausetime : word;
  8913.   Saucer    : pointer;
  8914.   X, Y      : integer;
  8915.   ulx, uly  : word;
  8916.   lrx, lry  : word;
  8917.   Size      : word;
  8918.   I         : word;
  8919. begin
  8920.   ClearDevice;
  8921.   FullPort;
  8922.  
  8923.   { PaintScreen }
  8924.   ClearDevice;
  8925.   MainWindow('GetImage / PutImage Demonstration');
  8926.   StatusLine('Esc aborts or press a key...');
  8927.   GetViewSettings(CurPort);
  8928.  
  8929.   { DrawSaucer }
  8930.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  8931.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  8932.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  8933.   Circle(StartX+10, StartY-12, 2);
  8934.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  8935.   Circle(StartX-10, StartY-12, 2);
  8936.   SetFillStyle(SolidFill, MaxColor);
  8937.   FloodFill(StartX+1, StartY+4, GetColor);
  8938.  
  8939.   { ReadSaucerImage }
  8940.   ulx := StartX-(r+1);
  8941.   uly := StartY-14;
  8942.   lrx := StartX+(r+1);
  8943.   lry := StartY+(r div 3)+3;
  8944.  
  8945.   Size := ImageSize(ulx, uly, lrx, lry);
  8946.   GetMem(Saucer, Size);
  8947.   GetImage(ulx, uly, lrx, lry, Saucer^);
  8948. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  8949.  
  8950.   { Plot some "stars" }
  8951.   for I := 1 to 1000 do
  8952.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  8953.   X := MaxX div 2;
  8954.   Y := MaxY div 2;
  8955.   PauseTime := 70;
  8956.  
  8957.   { Move the saucer around }
  8958.   repeat
  8959. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  8960.      Delay(PauseTime);
  8961. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  8962.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  8963.   until KeyPressed;
  8964.   FreeMem(Saucer, size);
  8965.   WaitToGo;
  8966. end; { PutImagePlay }
  8967.  
  8968. procedure PolyPlay;
  8969. { Draw random polygons with random fill styles on the screen }
  8970. const
  8971.   MaxPts = 5;
  8972. type
  8973.   PolygonType = array[1..MaxPts] of PointType;
  8974. var
  8975.   Poly : PolygonType;
  8976.   I, Color : word;
  8977. begin
  8978.   MainWindow('FillPoly demonstration');
  8979.   StatusLine('Esc aborts or press a key...');
  8980.   repeat
  8981.     Color := RandColor;
  8982.     SetFillStyle(Random(11)+1, Color);
  8983.     SetColor(Color);
  8984.     for I := 1 to MaxPts do
  8985.       with Poly[I] do
  8986.       begin
  8987.         X := Random(MaxX);
  8988.         Y := Random(MaxY);
  8989.       end;
  8990.     FillPoly(MaxPts, Poly);
  8991.   until KeyPressed;
  8992.   WaitToGo;
  8993. end; { PolyPlay }
  8994.  
  8995. procedure FillStylePlay;
  8996. { Display all of the predefined fill styles available }
  8997. var
  8998.   Style    : word;
  8999.   Width    : word;
  9000.   Height   : word;
  9001.   X, Y     : word;
  9002.   I, J     : word;
  9003.   ViewInfo : ViewPortType;
  9004.  
  9005. procedure DrawBox(X, Y : word);
  9006. begin
  9007.   SetFillStyle(Style, MaxColor);
  9008.   with ViewInfo do
  9009.     Bar(X, Y, X+Width, Y+Height);
  9010.   Rectangle(X, Y, X+Width, Y+Height);
  9011.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  9012.   Inc(Style);
  9013. end; { DrawBox }
  9014.  
  9015. begin
  9016.   MainWindow('Pre-defined fill styles');
  9017.   GetViewSettings(ViewInfo);
  9018.   with ViewInfo do
  9019.   begin
  9020.     Width := 2 * ((x2+1) div 13);
  9021.     Height := 2 * ((y2-10) div 10);
  9022.   end;
  9023.   X := Width div 2;
  9024.   Y := Height div 2;
  9025.   Style := 0;
  9026.   for J := 1 to 3 do
  9027.   begin
  9028.     for I := 1 to 4 do
  9029.     begin
  9030.       DrawBox(X, Y);
  9031.       Inc(X, (Width div 2) * 3);
  9032.     end;
  9033.     X := Width div 2;
  9034.     Inc(Y, (Height div 2) * 3);
  9035.   end;
  9036.   SetTextJustify(LeftText, TopText);
  9037.   WaitToGo;
  9038. end; { FillStylePlay }
  9039.  
  9040. procedure FillPatternPlay;
  9041. { Display some user defined fill patterns }
  9042. const
  9043.   Patterns : array[0..11] of FillPatternType = (
  9044.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  9045.             OldColor which has a path of pixels of OldColor or NewColor
  9046.             with sides touching back to the seed point, (XSeed, YSeed).
  9047.             Therefore, only pixels of OldColor are modified and no other
  9048.             information is changed.
  9049.  
  9050.             SEE ALSO
  9051.  
  9052.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  9053.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  9054.             SETVIEW
  9055.  
  9056.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  9057.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  9058.             IF WHICHVGA = 0 THEN STOP
  9059.             DUMMY=RES640
  9060.             SETVIEW 100, 100, 539, 379
  9061.             FILLVIEW 10
  9062.             WHILE INKEY$ = ""
  9063.             WEND
  9064.             VIDEOMODESET VMODE
  9065.             END
  9066.  
  9067.  
  9068.  
  9069.  
  9070.  
  9071.  
  9072.  
  9073.  
  9074.  
  9075.  
  9076.  
  9077.  
  9078.  
  9079.  
  9080.  
  9081.  
  9082.                                                                          63
  9083.  
  9084.  
  9085.  
  9086.  
  9087.  
  9088.  
  9089.           FONTGETINFO
  9090.  
  9091.             PROTOTYPE
  9092.  
  9093.             SUB FONTGETINFO (Width%, Height%)
  9094.  
  9095.             INPUT
  9096.  
  9097.             no input parameters
  9098.     WEND
  9099.             MOUSEEXIT
  9100.             VIDEOMODESET VMODE
  9101.             END
  9102.  
  9103.  
  9104.  
  9105.  
  9106.  
  9107.  
  9108.  
  9109.  
  9110.  
  9111.  
  9112.  
  9113.  
  9114.  
  9115.  
  9116.  
  9117.  
  9118.  
  9119.  
  9120.  
  9121.  
  9122.  
  9123.  
  9124.  
  9125.  
  9126.  
  9127.  
  9128.  
  9129.  
  9130.  
  9131.  
  9132.  
  9133.  
  9134.  
  9135.  
  9136.  
  9137.  
  9138.  
  9139.  
  9140.  
  9141.  
  9142.                                                                          86
  9143.  
  9144.  
  9145.  
  9146.  
  9147.  
  9148.  
  9149.           MOUSECURSORDEFAULT
  9150.  
  9151.             PROTOTYPE
  9152.  
  9153.             SUB MOUSECURSORDEFAULT ()
  9154.  
  9155.             INPUT
  9156.  
  9157.             no input parameters
  9158.  
  9159.             OUTPUT
  9160.  
  9161.             no value returned
  9162.  
  9163.             USAGE
  9164.  
  9165.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  9166.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  9167. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  9168. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  9169. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  9170. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  9171. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  9172. $╤
  9173. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  9174. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  9175. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  9176. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  9177. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  9178. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  9179. ░£▒
  9180. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  9181. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  9182.       end;
  9183.     end;
  9184.   end;
  9185.   WaitToGo;
  9186. end; { UserLineStylePlay }
  9187.  
  9188.  
  9189. procedure SayGoodbye;
  9190. { Say goodbye and then exit the program }
  9191. var
  9192.   ViewInfo : ViewPortType;
  9193. begin
  9194.   MainWindow('');
  9195.   GetViewSettings(ViewInfo);
  9196.   SetTextStyle(TriplexFont, HorizDir, 4);
  9197.   SetTextJustify(CenterText, CenterText);
  9198.   with ViewInfo do
  9199.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  9200.   StatusLine('Press any key to quit...');
  9201.   repeat until KeyPressed;
  9202. end; { SayGoodbye }
  9203.  
  9204.  
  9205. PROCEDURE SelectMode;
  9206. VAR
  9207.     choice1,choice2     : CHAR;
  9208.    xsize,ysize            : WORD;
  9209. BEGIN
  9210.     (* Let's select a mode *)
  9211.     ClrScr;
  9212.     WriteLn('VESADEMO:');
  9213.     WriteLn('1. 256 colors');
  9214.     WriteLn('2. 32768 colors');
  9215.     WriteLn('3. 65536 colors');
  9216.     WriteLn('4. 16777216 colors');
  9217.     WriteLn('Q uit');
  9218.     WriteLn;
  9219.     Write('Your choice: ');
  9220.     REPEAT
  9221.         ReadLn(choice1);
  9222.       IF choice1 <> '1' THEN BEGIN
  9223.           WriteLn('Sorry !');
  9224.          WriteLn('This demo wasn''t written for more as 256 colors !');
  9225.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  9226.          WriteLn('Switching to 256 colors.');
  9227.          choice1 := '1';
  9228.       END;
  9229.     UNTIL choice1 IN ['1'..'4','q'];
  9230.     IF choice1 = 'q' THEN Halt;
  9231.  
  9232.     WriteLn;
  9233.     WriteLn;
  9234.     WriteLn('a. 320x200');
  9235.     WriteLn('b. 640x480');
  9236.     WriteLn('c. 800x600');
  9237.     WriteLn('d. 1024x768');
  9238.     WriteLn('e. 1280x1024');
  9239.     WriteLn('Q uit');
  9240.     WriteLn;
  9241.     Write('Your choice: ');
  9242.     REPEAT
  9243.         ReadLn(choice2);
  9244.     UNTIL choice2 IN ['a'..'e','q'];
  9245.     IF choice2 = 'q' THEN Halt;
  9246.  
  9247.     CASE choice2 OF
  9248.         'a' : BEGIN
  9249.             xsize := 320;
  9250.             ysize := 200;
  9251.         END;
  9252.         'b' : BEGIN
  9253.             xsize := 640;
  9254.             ysize := 480;
  9255.         END;
  9256.         'c' : BEGIN
  9257.             xsize := 800;
  9258.             ysize := 600;
  9259.         END;
  9260.         'd' : BEGIN
  9261.             xsize := 1024;
  9262.             ysize := 768;
  9263.         END;
  9264.         'e' : BEGIN
  9265.             xsize := 1280;
  9266.             ysize := 1024;
  9267.         END;
  9268.     END;
  9269.     CASE choice1 OF
  9270.         '1' : mode := FindVesaMode(xsize,ysize,8);
  9271.         '2' : mode := FindVesaMode(xsize,ysize,15);
  9272.         '3' : mode := FindVesaMode(xsize,ysize,16);
  9273.         '4' : mode := FindVesaMode(xsize,ysize,24);
  9274.     END;
  9275.     IF mode = 0 THEN BEGIN
  9276.         WriteLn('No such mode could be found !');
  9277.         WriteLn('Switching to to 320x200.');
  9278.         ReadKey;
  9279.         mode := V320x200x256;
  9280.     END;
  9281. END;
  9282.  
  9283. begin { program body }
  9284.   SelectMode;
  9285.   Initialize;
  9286.   ReportStatus;
  9287.  
  9288. {  AspectRatioPlay; }
  9289.   FillEllipsePlay;
  9290.   SectorPlay;
  9291.   WriteModePlay;
  9292.  
  9293.   ColorPlay;
  9294.   { PalettePlay only intended to work on these drivers: }
  9295.   if (GraphDriver = EGA) or
  9296.       (GraphDriver = EGA64) or
  9297.       (GraphDriver = VGA) then
  9298.      PalettePlay;
  9299.   PutPixelPlay;
  9300. {  PutImagePlay; }
  9301.   RandBarPlay;
  9302.   BarPlay;
  9303.   Bar3DPlay;
  9304.   ArcPlay;
  9305.   CirclePlay;
  9306.   PiePlay;
  9307.   LineToPlay;
  9308.   LineRelPlay;
  9309. {  LineStylePlay; }
  9310. {  UserLineStylePlay; }
  9311.   TextDump;
  9312.   TextPlay;
  9313.   CrtModePlay;
  9314.   FillStylePlay;
  9315.   FillPatternPlay;
  9316.   PolyPlay;
  9317.   SayGoodbye;
  9318. {  CloseGraph; }
  9319.   CloseVesa;
  9320. end.
  9321. ***************************************************
  9322.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  9323.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  9324. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  9325. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  9326. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  9327. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  9328.     Color := RandColor;
  9329.     SetColor(Color);
  9330.     SetFillStyle(Random(CloseDotFill)+1, Color);
  9331.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  9332.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  9333.   until KeyPressed;
  9334.   WaitToGo;
  9335. end; { RandBarPlay }
  9336.  
  9337. procedure ArcPlay;
  9338. { Draw random arcs on the screen }
  9339. var
  9340.   MaxRadius : word;
  9341.   EndAngle : word;
  9342.   ArcInfo : ArcCoordsType;
  9343. begin
  9344.   MainWindow('Arc / GetArcCoords demonstration');
  9345.   StatusLine('Esc aborts or press a key');
  9346.   MaxRadius := MaxY div 10;
  9347.   repeat
  9348.     SetColor(RandColor);
  9349.     EndAngle := Random(360);
  9350.     SetLineStyle(SolidLn, 0, NormWidth);
  9351.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  9352.     GetArcCoords(ArcInfo);
  9353.     with ArcInfo do
  9354.     begin
  9355.       Line(X, Y, XStart, YStart);
  9356.       Line(X, Y, Xend, Yend);
  9357.     end;
  9358.   until KeyPressed;
  9359.   WaitToGo;
  9360. end; { ArcPlay }
  9361.  
  9362. procedure PutPixelPlay;
  9363. { Demonstrate the PutPixel and GetPixel commands }
  9364. const
  9365.   Seed   = 1962; { A seed for the random number generator }
  9366.   NumPts = 2000; { The number of pixels plotted }
  9367.   Esc    = #27;
  9368. var
  9369.   I : word;
  9370.   X, Y, Color : word;
  9371.   XMax, YMax  : integer;
  9372.   ViewInfo    : ViewPortType;
  9373. begin
  9374.   MainWindow('PutPixel / GetPixel demonstration');
  9375.   StatusLine('Esc aborts or press a key...');
  9376.  
  9377.   GetViewSettings(ViewInfo);
  9378.   with ViewInfo do
  9379.   begin
  9380.     XMax := (x2-x1-1);
  9381.     YMax := (y2-y1-1);
  9382.   end;
  9383.  
  9384.   while not KeyPressed do
  9385.   begin
  9386.     { Plot random pixels }
  9387.     RandSeed := Seed;
  9388.     I := 0;
  9389.     while (not KeyPressed) and (I < NumPts) do
  9390.     begin
  9391.       Inc(I);
  9392.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  9393.     end;
  9394.  
  9395.     { Erase pixels }
  9396.     RandSeed := Seed;
  9397.     I := 0;
  9398.     while (not KeyPressed) and (I < NumPts) do
  9399.     begin
  9400.       Inc(I);
  9401.       X := Random(XMax)+1;
  9402.       Y := Random(YMax)+1;
  9403.       Color := GetPixel(X, Y);
  9404.         if Color = RandColor then
  9405.           PutPixel(X, Y, 0);
  9406.      end;
  9407.   end;
  9408.   WaitToGo;
  9409. end; { PutPixelPlay }
  9410.  
  9411. procedure PutImagePlay;
  9412. { Demonstrate the GetImage and PutImage commands }
  9413.  
  9414. const
  9415.   r  = 20;
  9416.   StartX = 100;
  9417.   StartY = 50;
  9418.  
  9419. var
  9420.   CurPort : ViewPortType;
  9421.  
  9422. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  9423. var
  9424.   Step : integer;
  9425. begin
  9426.   Step := Random(2*r);
  9427.   if Odd(Step) then
  9428.     Step := -Step;
  9429.   X := X + Step;
  9430.   Step := Random(r);
  9431.   if Odd(Step) then
  9432.     Step := -Step;
  9433.   Y := Y + Step;
  9434.  
  9435.   { Make saucer bounce off viewport walls }
  9436.   with CurPort do
  9437.   begin
  9438.     if (x1 + X + Width - 1 > x2) then
  9439.       X := x2-x1 - Width + 1
  9440.     else
  9441.       if (X < 0) then
  9442.         X := 0;
  9443.     if (y1 + Y + Height - 1 > y2) then
  9444.       Y := y2-y1 - Height + 1
  9445.     else
  9446.       if (Y < 0) then
  9447.         Y := 0;
  9448.   end;
  9449. end; { MoveSaucer }
  9450.  
  9451. var
  9452.   Pausetime : word;
  9453.   Saucer    : pointer;
  9454.   X, Y      : integer;
  9455.   ulx, uly  : word;
  9456.   lrx, lry  : word;
  9457.   Size      : word;
  9458.   I         : word;
  9459. begin
  9460.   ClearDevice;
  9461.   FullPort;
  9462.  
  9463.   { PaintScreen }
  9464.   ClearDevice;
  9465.   MainWindow('GetImage / PutImage Demonstration');
  9466.   StatusLine('Esc aborts or press a key...');
  9467.   GetViewSettings(CurPort);
  9468.  
  9469.   { DrawSaucer }
  9470.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  9471.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  9472.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  9473.   Circle(StartX+10, StartY-12, 2);
  9474.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  9475.   Circle(StartX-10, StartY-12, 2);
  9476.   SetFillStyle(SolidFill, MaxColor);
  9477.   FloodFill(StartX+1, StartY+4, GetColor);
  9478.  
  9479.   { ReadSaucerImage }
  9480.   ulx := StartX-(r+1);
  9481.   uly := StartY-14;
  9482.   lrx := StartX+(r+1);
  9483.   lry := StartY+(r div 3)+3;
  9484.  
  9485.   Size := ImageSize(ulx, uly, lrx, lry);
  9486.   GetMem(Saucer, Size);
  9487.   GetImage(ulx, uly, lrx, lry, Saucer^);
  9488. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  9489.  
  9490.   { Plot some "stars" }
  9491.   for I := 1 to 1000 do
  9492.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  9493.   X := MaxX div 2;
  9494.   Y := MaxY div 2;
  9495.   PauseTime := 70;
  9496.  
  9497.   { Move the saucer around }
  9498.   repeat
  9499. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  9500.      Delay(PauseTime);
  9501. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  9502.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  9503.   until KeyPressed;
  9504.   FreeMem(Saucer, size);
  9505.   WaitToGo;
  9506. end; { PutImagePlay }
  9507.  
  9508. procedure PolyPlay;
  9509. { Draw random polygons with random fill styles on the screen }
  9510. const
  9511.   MaxPts = 5;
  9512. type
  9513.   PolygonType = array[1..MaxPts] of PointType;
  9514. var
  9515.   Poly : PolygonType;
  9516.   I, Color : word;
  9517. begin
  9518.   MainWindow('FillPoly demonstration');
  9519.   StatusLine('Esc aborts or press a key...');
  9520.   repeat
  9521.     Color := RandColor;
  9522.     SetFillStyle(Random(11)+1, Color);
  9523.     SetColor(Color);
  9524.     for I := 1 to MaxPts do
  9525.       with Poly[I] do
  9526.       begin
  9527.         X := Random(MaxX);
  9528.         Y := Random(MaxY);
  9529.       end;
  9530.     FillPoly(MaxPts, Poly);
  9531.   until KeyPressed;
  9532.   WaitToGo;
  9533. end; { PolyPlay }
  9534.  
  9535. procedure FillStylePlay;
  9536. { Display all of the predefined fill styles available }
  9537. var
  9538.   Style    : word;
  9539.   Width    : word;
  9540.   Height   : word;
  9541.   X, Y     : word;
  9542.   I, J     : word;
  9543.   ViewInfo : ViewPortType;
  9544.  
  9545. procedure DrawBox(X, Y : word);
  9546. begin
  9547.   SetFillStyle(Style, MaxColor);
  9548.   with ViewInfo do
  9549.     Bar(X, Y, X+Width, Y+Height);
  9550.   Rectangle(X, Y, X+Width, Y+Height);
  9551.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  9552.   Inc(Style);
  9553. end; { DrawBox }
  9554.  
  9555. begin
  9556.   MainWindow('Pre-defined fill styles');
  9557.   GetViewSettings(ViewInfo);
  9558.   with ViewInfo do
  9559.   begin
  9560.     Width := 2 * ((x2+1) div 13);
  9561.     Height := 2 * ((y2-10) div 10);
  9562.   end;
  9563.   X := Width div 2;
  9564.   Y := Height div 2;
  9565.   Style := 0;
  9566.   for J := 1 to 3 do
  9567.   begin
  9568.     for I := 1 to 4 do
  9569.     begin
  9570.       DrawBox(X, Y);
  9571.       Inc(X, (Width div 2) * 3);
  9572.     end;
  9573.     X := Width div 2;
  9574.     Inc(Y, (Height div 2) * 3);
  9575.   end;
  9576.   SetTextJustify(LeftText, TopText);
  9577.   WaitToGo;
  9578. end; { FillStylePlay }
  9579.  
  9580. procedure FillPatternPlay;
  9581. { Display some user defined fill patterns }
  9582. const
  9583.   Patterns : array[0..11] of FillPatternType = (
  9584.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  9585.             OldColor which has a path of pixels of OldColor or NewColor
  9586.             with sides touching back to the seed point, (XSeed, YSeed).
  9587.             Therefore, only pixels of OldColor are modified and no other
  9588.             information is changed.
  9589.  
  9590.             SEE ALSO
  9591.  
  9592.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  9593.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  9594.             SETVIEW
  9595.  
  9596.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  9597.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  9598.             IF WHICHVGA = 0 THEN STOP
  9599.             DUMMY=RES640
  9600.             SETVIEW 100, 100, 539, 379
  9601.             FILLVIEW 10
  9602.             WHILE INKEY$ = ""
  9603.             WEND
  9604.             VIDEOMODESET VMODE
  9605.             END
  9606.  
  9607.  
  9608.  
  9609.  
  9610.  
  9611.  
  9612.  
  9613.  
  9614.  
  9615.  
  9616.  
  9617.  
  9618.  
  9619.  
  9620.  
  9621.  
  9622.                                                                          63
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.  
  9629.           FONTGETINFO
  9630.  
  9631.             PROTOTYPE
  9632.  
  9633.             SUB FONTGETINFO (Width%, Height%)
  9634.  
  9635.             INPUT
  9636.  
  9637.             no input parameters
  9638.     WEND
  9639.             MOUSEEXIT
  9640.             VIDEOMODESET VMODE
  9641.             END
  9642.  
  9643.  
  9644.  
  9645.  
  9646.  
  9647.  
  9648.  
  9649.  
  9650.  
  9651.  
  9652.  
  9653.  
  9654.  
  9655.  
  9656.  
  9657.  
  9658.  
  9659.  
  9660.  
  9661.  
  9662.  
  9663.  
  9664.  
  9665.  
  9666.  
  9667.  
  9668.  
  9669.  
  9670.  
  9671.  
  9672.  
  9673.  
  9674.  
  9675.  
  9676.  
  9677.  
  9678.  
  9679.  
  9680.  
  9681.  
  9682.                                                                          86
  9683.  
  9684.  
  9685.  
  9686.  
  9687.  
  9688.  
  9689.           MOUSECURSORDEFAULT
  9690.  
  9691.             PROTOTYPE
  9692.  
  9693.             SUB MOUSECURSORDEFAULT ()
  9694.  
  9695.             INPUT
  9696.  
  9697.             no input parameters
  9698.  
  9699.             OUTPUT
  9700.  
  9701.             no value returned
  9702.  
  9703.             USAGE
  9704.  
  9705.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  9706.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  9707. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  9708. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  9709. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  9710. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  9711. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  9712. $╤
  9713. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  9714. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  9715. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  9716. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  9717. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  9718. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  9719. ░£▒
  9720. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  9721. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  9722.       end;
  9723.     end;
  9724.   end;
  9725.   WaitToGo;
  9726. end; { UserLineStylePlay }
  9727.  
  9728.  
  9729. procedure SayGoodbye;
  9730. { Say goodbye and then exit the program }
  9731. var
  9732.   ViewInfo : ViewPortType;
  9733. begin
  9734.   MainWindow('');
  9735.   GetViewSettings(ViewInfo);
  9736.   SetTextStyle(TriplexFont, HorizDir, 4);
  9737.   SetTextJustify(CenterText, CenterText);
  9738.   with ViewInfo do
  9739.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  9740.   StatusLine('Press any key to quit...');
  9741.   repeat until KeyPressed;
  9742. end; { SayGoodbye }
  9743.  
  9744.  
  9745. PROCEDURE SelectMode;
  9746. VAR
  9747.     choice1,choice2     : CHAR;
  9748.    xsize,ysize            : WORD;
  9749. BEGIN
  9750.     (* Let's select a mode *)
  9751.     ClrScr;
  9752.     WriteLn('VESADEMO:');
  9753.     WriteLn('1. 256 colors');
  9754.     WriteLn('2. 32768 colors');
  9755.     WriteLn('3. 65536 colors');
  9756.     WriteLn('4. 16777216 colors');
  9757.     WriteLn('Q uit');
  9758.     WriteLn;
  9759.     Write('Your choice: ');
  9760.     REPEAT
  9761.         ReadLn(choice1);
  9762.       IF choice1 <> '1' THEN BEGIN
  9763.           WriteLn('Sorry !');
  9764.          WriteLn('This demo wasn''t written for more as 256 colors !');
  9765.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  9766.          WriteLn('Switching to 256 colors.');
  9767.          choice1 := '1';
  9768.       END;
  9769.     UNTIL choice1 IN ['1'..'4','q'];
  9770.     IF choice1 = 'q' THEN Halt;
  9771.  
  9772.     WriteLn;
  9773.     WriteLn;
  9774.     WriteLn('a. 320x200');
  9775.     WriteLn('b. 640x480');
  9776.     WriteLn('c. 800x600');
  9777.     WriteLn('d. 1024x768');
  9778.     WriteLn('e. 1280x1024');
  9779.     WriteLn('Q uit');
  9780.     WriteLn;
  9781.     Write('Your choice: ');
  9782.     REPEAT
  9783.         ReadLn(choice2);
  9784.     UNTIL choice2 IN ['a'..'e','q'];
  9785.     IF choice2 = 'q' THEN Halt;
  9786.  
  9787.     CASE choice2 OF
  9788.         'a' : BEGIN
  9789.             xsize := 320;
  9790.             ysize := 200;
  9791.         END;
  9792.         'b' : BEGIN
  9793.             xsize := 640;
  9794.             ysize := 480;
  9795.         END;
  9796.         'c' : BEGIN
  9797.             xsize := 800;
  9798.             ysize := 600;
  9799.         END;
  9800.         'd' : BEGIN
  9801.             xsize := 1024;
  9802.             ysize := 768;
  9803.         END;
  9804.         'e' : BEGIN
  9805.             xsize := 1280;
  9806.             ysize := 1024;
  9807.         END;
  9808.     END;
  9809.     CASE choice1 OF
  9810.         '1' : mode := FindVesaMode(xsize,ysize,8);
  9811.         '2' : mode := FindVesaMode(xsize,ysize,15);
  9812.         '3' : mode := FindVesaMode(xsize,ysize,16);
  9813.         '4' : mode := FindVesaMode(xsize,ysize,24);
  9814.     END;
  9815.     IF mode = 0 THEN BEGIN
  9816.         WriteLn('No such mode could be found !');
  9817.         WriteLn('Switching to to 320x200.');
  9818.         ReadKey;
  9819.         mode := V320x200x256;
  9820.     END;
  9821. END;
  9822.  
  9823. begin { program body }
  9824.   SelectMode;
  9825.   Initialize;
  9826.   ReportStatus;
  9827.  
  9828. {  AspectRatioPlay; }
  9829.   FillEllipsePlay;
  9830.   SectorPlay;
  9831.   WriteModePlay;
  9832.  
  9833.   ColorPlay;
  9834.   { PalettePlay only intended to work on these drivers: }
  9835.   if (GraphDriver = EGA) or
  9836.       (GraphDriver = EGA64) or
  9837.       (GraphDriver = VGA) then
  9838.      PalettePlay;
  9839.   PutPixelPlay;
  9840. {  PutImagePlay; }
  9841.   RandBarPlay;
  9842.   BarPlay;
  9843.   Bar3DPlay;
  9844.   ArcPlay;
  9845.   CirclePlay;
  9846.   PiePlay;
  9847.   LineToPlay;
  9848.   LineRelPlay;
  9849. {  LineStylePlay; }
  9850. {  UserLineStylePlay; }
  9851.   TextDump;
  9852.   TextPlay;
  9853.   CrtModePlay;
  9854.   FillStylePlay;
  9855.   FillPatternPlay;
  9856.   PolyPlay;
  9857.   SayGoodbye;
  9858. {  CloseGraph; }
  9859.   CloseVesa;
  9860. end.
  9861. ***************************************************
  9862.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  9863.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  9864. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  9865. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  9866. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  9867. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  9868.     Color := RandColor;
  9869.     SetColor(Color);
  9870.     SetFillStyle(Random(CloseDotFill)+1, Color);
  9871.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  9872.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  9873.   until KeyPressed;
  9874.   WaitToGo;
  9875. end; { RandBarPlay }
  9876.  
  9877. procedure ArcPlay;
  9878. { Draw random arcs on the screen }
  9879. var
  9880.   MaxRadius : word;
  9881.   EndAngle : word;
  9882.   ArcInfo : ArcCoordsType;
  9883. begin
  9884.   MainWindow('Arc / GetArcCoords demonstration');
  9885.   StatusLine('Esc aborts or press a key');
  9886.   MaxRadius := MaxY div 10;
  9887.   repeat
  9888.     SetColor(RandColor);
  9889.     EndAngle := Random(360);
  9890.     SetLineStyle(SolidLn, 0, NormWidth);
  9891.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  9892.     GetArcCoords(ArcInfo);
  9893.     with ArcInfo do
  9894.     begin
  9895.       Line(X, Y, XStart, YStart);
  9896.       Line(X, Y, Xend, Yend);
  9897.     end;
  9898.   until KeyPressed;
  9899.   WaitToGo;
  9900. end; { ArcPlay }
  9901.  
  9902. procedure PutPixelPlay;
  9903. { Demonstrate the PutPixel and GetPixel commands }
  9904. const
  9905.   Seed   = 1962; { A seed for the random number generator }
  9906.   NumPts = 2000; { The number of pixels plotted }
  9907.   Esc    = #27;
  9908. var
  9909.   I : word;
  9910.   X, Y, Color : word;
  9911.   XMax, YMax  : integer;
  9912.   ViewInfo    : ViewPortType;
  9913. begin
  9914.   MainWindow('PutPixel / GetPixel demonstration');
  9915.   StatusLine('Esc aborts or press a key...');
  9916.  
  9917.   GetViewSettings(ViewInfo);
  9918.   with ViewInfo do
  9919.   begin
  9920.     XMax := (x2-x1-1);
  9921.     YMax := (y2-y1-1);
  9922.   end;
  9923.  
  9924.   while not KeyPressed do
  9925.   begin
  9926.     { Plot random pixels }
  9927.     RandSeed := Seed;
  9928.     I := 0;
  9929.     while (not KeyPressed) and (I < NumPts) do
  9930.     begin
  9931.       Inc(I);
  9932.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  9933.     end;
  9934.  
  9935.     { Erase pixels }
  9936.     RandSeed := Seed;
  9937.     I := 0;
  9938.     while (not KeyPressed) and (I < NumPts) do
  9939.     begin
  9940.       Inc(I);
  9941.       X := Random(XMax)+1;
  9942.       Y := Random(YMax)+1;
  9943.       Color := GetPixel(X, Y);
  9944.         if Color = RandColor then
  9945.           PutPixel(X, Y, 0);
  9946.      end;
  9947.   end;
  9948.   WaitToGo;
  9949. end; { PutPixelPlay }
  9950.  
  9951. procedure PutImagePlay;
  9952. { Demonstrate the GetImage and PutImage commands }
  9953.  
  9954. const
  9955.   r  = 20;
  9956.   StartX = 100;
  9957.   StartY = 50;
  9958.  
  9959. var
  9960.   CurPort : ViewPortType;
  9961.  
  9962. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  9963. var
  9964.   Step : integer;
  9965. begin
  9966.   Step := Random(2*r);
  9967.   if Odd(Step) then
  9968.     Step := -Step;
  9969.   X := X + Step;
  9970.   Step := Random(r);
  9971.   if Odd(Step) then
  9972.     Step := -Step;
  9973.   Y := Y + Step;
  9974.  
  9975.   { Make saucer bounce off viewport walls }
  9976.   with CurPort do
  9977.   begin
  9978.     if (x1 + X + Width - 1 > x2) then
  9979.       X := x2-x1 - Width + 1
  9980.     else
  9981.       if (X < 0) then
  9982.         X := 0;
  9983.     if (y1 + Y + Height - 1 > y2) then
  9984.       Y := y2-y1 - Height + 1
  9985.     else
  9986.       if (Y < 0) then
  9987.         Y := 0;
  9988.   end;
  9989. end; { MoveSaucer }
  9990.  
  9991. var
  9992.   Pausetime : word;
  9993.   Saucer    : pointer;
  9994.   X, Y      : integer;
  9995.   ulx, uly  : word;
  9996.   lrx, lry  : word;
  9997.   Size      : word;
  9998.   I         : word;
  9999. begin
  10000.   ClearDevice;
  10001.   FullPort;
  10002.  
  10003.   { PaintScreen }
  10004.   ClearDevice;
  10005.   MainWindow('GetImage / PutImage Demonstration');
  10006.   StatusLine('Esc aborts or press a key...');
  10007.   GetViewSettings(CurPort);
  10008.  
  10009.   { DrawSaucer }
  10010.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  10011.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  10012.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  10013.   Circle(StartX+10, StartY-12, 2);
  10014.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  10015.   Circle(StartX-10, StartY-12, 2);
  10016.   SetFillStyle(SolidFill, MaxColor);
  10017.   FloodFill(StartX+1, StartY+4, GetColor);
  10018.  
  10019.   { ReadSaucerImage }
  10020.   ulx := StartX-(r+1);
  10021.   uly := StartY-14;
  10022.   lrx := StartX+(r+1);
  10023.   lry := StartY+(r div 3)+3;
  10024.  
  10025.   Size := ImageSize(ulx, uly, lrx, lry);
  10026.   GetMem(Saucer, Size);
  10027.   GetImage(ulx, uly, lrx, lry, Saucer^);
  10028. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  10029.  
  10030.   { Plot some "stars" }
  10031.   for I := 1 to 1000 do
  10032.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  10033.   X := MaxX div 2;
  10034.   Y := MaxY div 2;
  10035.   PauseTime := 70;
  10036.  
  10037.   { Move the saucer around }
  10038.   repeat
  10039. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  10040.      Delay(PauseTime);
  10041. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  10042.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  10043.   until KeyPressed;
  10044.   FreeMem(Saucer, size);
  10045.   WaitToGo;
  10046. end; { PutImagePlay }
  10047.  
  10048. procedure PolyPlay;
  10049. { Draw random polygons with random fill styles on the screen }
  10050. const
  10051.   MaxPts = 5;
  10052. type
  10053.   PolygonType = array[1..MaxPts] of PointType;
  10054. var
  10055.   Poly : PolygonType;
  10056.   I, Color : word;
  10057. begin
  10058.   MainWindow('FillPoly demonstration');
  10059.   StatusLine('Esc aborts or press a key...');
  10060.   repeat
  10061.     Color := RandColor;
  10062.     SetFillStyle(Random(11)+1, Color);
  10063.     SetColor(Color);
  10064.     for I := 1 to MaxPts do
  10065.       with Poly[I] do
  10066.       begin
  10067.         X := Random(MaxX);
  10068.         Y := Random(MaxY);
  10069.       end;
  10070.     FillPoly(MaxPts, Poly);
  10071.   until KeyPressed;
  10072.   WaitToGo;
  10073. end; { PolyPlay }
  10074.  
  10075. procedure FillStylePlay;
  10076. { Display all of the predefined fill styles available }
  10077. var
  10078.   Style    : word;
  10079.   Width    : word;
  10080.   Height   : word;
  10081.   X, Y     : word;
  10082.   I, J     : word;
  10083.   ViewInfo : ViewPortType;
  10084.  
  10085. procedure DrawBox(X, Y : word);
  10086. begin
  10087.   SetFillStyle(Style, MaxColor);
  10088.   with ViewInfo do
  10089.     Bar(X, Y, X+Width, Y+Height);
  10090.   Rectangle(X, Y, X+Width, Y+Height);
  10091.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  10092.   Inc(Style);
  10093. end; { DrawBox }
  10094.  
  10095. begin
  10096.   MainWindow('Pre-defined fill styles');
  10097.   GetViewSettings(ViewInfo);
  10098.   with ViewInfo do
  10099.   begin
  10100.     Width := 2 * ((x2+1) div 13);
  10101.     Height := 2 * ((y2-10) div 10);
  10102.   end;
  10103.   X := Width div 2;
  10104.   Y := Height div 2;
  10105.   Style := 0;
  10106.   for J := 1 to 3 do
  10107.   begin
  10108.     for I := 1 to 4 do
  10109.     begin
  10110.       DrawBox(X, Y);
  10111.       Inc(X, (Width div 2) * 3);
  10112.     end;
  10113.     X := Width div 2;
  10114.     Inc(Y, (Height div 2) * 3);
  10115.   end;
  10116.   SetTextJustify(LeftText, TopText);
  10117.   WaitToGo;
  10118. end; { FillStylePlay }
  10119.  
  10120. procedure FillPatternPlay;
  10121. { Display some user defined fill patterns }
  10122. const
  10123.   Patterns : array[0..11] of FillPatternType = (
  10124.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  10125.             OldColor which has a path of pixels of OldColor or NewColor
  10126.             with sides touching back to the seed point, (XSeed, YSeed).
  10127.             Therefore, only pixels of OldColor are modified and no other
  10128.             information is changed.
  10129.  
  10130.             SEE ALSO
  10131.  
  10132.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  10133.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  10134.             SETVIEW
  10135.  
  10136.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  10137.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  10138.             IF WHICHVGA = 0 THEN STOP
  10139.             DUMMY=RES640
  10140.             SETVIEW 100, 100, 539, 379
  10141.             FILLVIEW 10
  10142.             WHILE INKEY$ = ""
  10143.             WEND
  10144.             VIDEOMODESET VMODE
  10145.             END
  10146.  
  10147.  
  10148.  
  10149.  
  10150.  
  10151.  
  10152.  
  10153.  
  10154.  
  10155.  
  10156.  
  10157.  
  10158.  
  10159.  
  10160.  
  10161.  
  10162.                                                                          63
  10163.  
  10164.  
  10165.  
  10166.  
  10167.  
  10168.  
  10169.           FONTGETINFO
  10170.  
  10171.             PROTOTYPE
  10172.  
  10173.             SUB FONTGETINFO (Width%, Height%)
  10174.  
  10175.             INPUT
  10176.  
  10177.             no input parameters
  10178.     WEND
  10179.             MOUSEEXIT
  10180.             VIDEOMODESET VMODE
  10181.             END
  10182.  
  10183.  
  10184.  
  10185.  
  10186.  
  10187.  
  10188.  
  10189.  
  10190.  
  10191.  
  10192.  
  10193.  
  10194.  
  10195.  
  10196.  
  10197.  
  10198.  
  10199.  
  10200.  
  10201.  
  10202.  
  10203.  
  10204.  
  10205.  
  10206.  
  10207.  
  10208.  
  10209.  
  10210.  
  10211.  
  10212.  
  10213.  
  10214.  
  10215.  
  10216.  
  10217.  
  10218.  
  10219.  
  10220.  
  10221.  
  10222.                                                                          86
  10223.  
  10224.  
  10225.  
  10226.  
  10227.  
  10228.  
  10229.           MOUSECURSORDEFAULT
  10230.  
  10231.             PROTOTYPE
  10232.  
  10233.             SUB MOUSECURSORDEFAULT ()
  10234.  
  10235.             INPUT
  10236.  
  10237.             no input parameters
  10238.  
  10239.             OUTPUT
  10240.  
  10241.             no value returned
  10242.  
  10243.             USAGE
  10244.  
  10245.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  10246.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  10247. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  10248. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  10249. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  10250. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  10251. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  10252. $╤
  10253. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  10254. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  10255. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  10256. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  10257. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  10258. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  10259. ░£▒
  10260. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  10261. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  10262.       end;
  10263.     end;
  10264.   end;
  10265.   WaitToGo;
  10266. end; { UserLineStylePlay }
  10267.  
  10268.  
  10269. procedure SayGoodbye;
  10270. { Say goodbye and then exit the program }
  10271. var
  10272.   ViewInfo : ViewPortType;
  10273. begin
  10274.   MainWindow('');
  10275.   GetViewSettings(ViewInfo);
  10276.   SetTextStyle(TriplexFont, HorizDir, 4);
  10277.   SetTextJustify(CenterText, CenterText);
  10278.   with ViewInfo do
  10279.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  10280.   StatusLine('Press any key to quit...');
  10281.   repeat until KeyPressed;
  10282. end; { SayGoodbye }
  10283.  
  10284.  
  10285. PROCEDURE SelectMode;
  10286. VAR
  10287.     choice1,choice2     : CHAR;
  10288.    xsize,ysize            : WORD;
  10289. BEGIN
  10290.     (* Let's select a mode *)
  10291.     ClrScr;
  10292.     WriteLn('VESADEMO:');
  10293.     WriteLn('1. 256 colors');
  10294.     WriteLn('2. 32768 colors');
  10295.     WriteLn('3. 65536 colors');
  10296.     WriteLn('4. 16777216 colors');
  10297.     WriteLn('Q uit');
  10298.     WriteLn;
  10299.     Write('Your choice: ');
  10300.     REPEAT
  10301.         ReadLn(choice1);
  10302.       IF choice1 <> '1' THEN BEGIN
  10303.           WriteLn('Sorry !');
  10304.          WriteLn('This demo wasn''t written for more as 256 colors !');
  10305.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  10306.          WriteLn('Switching to 256 colors.');
  10307.          choice1 := '1';
  10308.       END;
  10309.     UNTIL choice1 IN ['1'..'4','q'];
  10310.     IF choice1 = 'q' THEN Halt;
  10311.  
  10312.     WriteLn;
  10313.     WriteLn;
  10314.     WriteLn('a. 320x200');
  10315.     WriteLn('b. 640x480');
  10316.     WriteLn('c. 800x600');
  10317.     WriteLn('d. 1024x768');
  10318.     WriteLn('e. 1280x1024');
  10319.     WriteLn('Q uit');
  10320.     WriteLn;
  10321.     Write('Your choice: ');
  10322.     REPEAT
  10323.         ReadLn(choice2);
  10324.     UNTIL choice2 IN ['a'..'e','q'];
  10325.     IF choice2 = 'q' THEN Halt;
  10326.  
  10327.     CASE choice2 OF
  10328.         'a' : BEGIN
  10329.             xsize := 320;
  10330.             ysize := 200;
  10331.         END;
  10332.         'b' : BEGIN
  10333.             xsize := 640;
  10334.             ysize := 480;
  10335.         END;
  10336.         'c' : BEGIN
  10337.             xsize := 800;
  10338.             ysize := 600;
  10339.         END;
  10340.         'd' : BEGIN
  10341.             xsize := 1024;
  10342.             ysize := 768;
  10343.         END;
  10344.         'e' : BEGIN
  10345.             xsize := 1280;
  10346.             ysize := 1024;
  10347.         END;
  10348.     END;
  10349.     CASE choice1 OF
  10350.         '1' : mode := FindVesaMode(xsize,ysize,8);
  10351.         '2' : mode := FindVesaMode(xsize,ysize,15);
  10352.         '3' : mode := FindVesaMode(xsize,ysize,16);
  10353.         '4' : mode := FindVesaMode(xsize,ysize,24);
  10354.     END;
  10355.     IF mode = 0 THEN BEGIN
  10356.         WriteLn('No such mode could be found !');
  10357.         WriteLn('Switching to to 320x200.');
  10358.         ReadKey;
  10359.         mode := V320x200x256;
  10360.     END;
  10361. END;
  10362.  
  10363. begin { program body }
  10364.   SelectMode;
  10365.   Initialize;
  10366.   ReportStatus;
  10367.  
  10368. {  AspectRatioPlay; }
  10369.   FillEllipsePlay;
  10370.   SectorPlay;
  10371.   WriteModePlay;
  10372.  
  10373.   ColorPlay;
  10374.   { PalettePlay only intended to work on these drivers: }
  10375.   if (GraphDriver = EGA) or
  10376.       (GraphDriver = EGA64) or
  10377.       (GraphDriver = VGA) then
  10378.      PalettePlay;
  10379.   PutPixelPlay;
  10380. {  PutImagePlay; }
  10381.   RandBarPlay;
  10382.   BarPlay;
  10383.   Bar3DPlay;
  10384.   ArcPlay;
  10385.   CirclePlay;
  10386.   PiePlay;
  10387.   LineToPlay;
  10388.   LineRelPlay;
  10389. {  LineStylePlay; }
  10390. {  UserLineStylePlay; }
  10391.   TextDump;
  10392.   TextPlay;
  10393.   CrtModePlay;
  10394.   FillStylePlay;
  10395.   FillPatternPlay;
  10396.   PolyPlay;
  10397.   SayGoodbye;
  10398. {  CloseGraph; }
  10399.   CloseVesa;
  10400. end.
  10401. ***************************************************
  10402.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  10403.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  10404. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  10405. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  10406. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  10407. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  10408.     Color := RandColor;
  10409.     SetColor(Color);
  10410.     SetFillStyle(Random(CloseDotFill)+1, Color);
  10411.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  10412.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  10413.   until KeyPressed;
  10414.   WaitToGo;
  10415. end; { RandBarPlay }
  10416.  
  10417. procedure ArcPlay;
  10418. { Draw random arcs on the screen }
  10419. var
  10420.   MaxRadius : word;
  10421.   EndAngle : word;
  10422.   ArcInfo : ArcCoordsType;
  10423. begin
  10424.   MainWindow('Arc / GetArcCoords demonstration');
  10425.   StatusLine('Esc aborts or press a key');
  10426.   MaxRadius := MaxY div 10;
  10427.   repeat
  10428.     SetColor(RandColor);
  10429.     EndAngle := Random(360);
  10430.     SetLineStyle(SolidLn, 0, NormWidth);
  10431.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  10432.     GetArcCoords(ArcInfo);
  10433.     with ArcInfo do
  10434.     begin
  10435.       Line(X, Y, XStart, YStart);
  10436.       Line(X, Y, Xend, Yend);
  10437.     end;
  10438.   until KeyPressed;
  10439.   WaitToGo;
  10440. end; { ArcPlay }
  10441.  
  10442. procedure PutPixelPlay;
  10443. { Demonstrate the PutPixel and GetPixel commands }
  10444. const
  10445.   Seed   = 1962; { A seed for the random number generator }
  10446.   NumPts = 2000; { The number of pixels plotted }
  10447.   Esc    = #27;
  10448. var
  10449.   I : word;
  10450.   X, Y, Color : word;
  10451.   XMax, YMax  : integer;
  10452.   ViewInfo    : ViewPortType;
  10453. begin
  10454.   MainWindow('PutPixel / GetPixel demonstration');
  10455.   StatusLine('Esc aborts or press a key...');
  10456.  
  10457.   GetViewSettings(ViewInfo);
  10458.   with ViewInfo do
  10459.   begin
  10460.     XMax := (x2-x1-1);
  10461.     YMax := (y2-y1-1);
  10462.   end;
  10463.  
  10464.   while not KeyPressed do
  10465.   begin
  10466.     { Plot random pixels }
  10467.     RandSeed := Seed;
  10468.     I := 0;
  10469.     while (not KeyPressed) and (I < NumPts) do
  10470.     begin
  10471.       Inc(I);
  10472.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  10473.     end;
  10474.  
  10475.     { Erase pixels }
  10476.     RandSeed := Seed;
  10477.     I := 0;
  10478.     while (not KeyPressed) and (I < NumPts) do
  10479.     begin
  10480.       Inc(I);
  10481.       X := Random(XMax)+1;
  10482.       Y := Random(YMax)+1;
  10483.       Color := GetPixel(X, Y);
  10484.         if Color = RandColor then
  10485.           PutPixel(X, Y, 0);
  10486.      end;
  10487.   end;
  10488.   WaitToGo;
  10489. end; { PutPixelPlay }
  10490.  
  10491. procedure PutImagePlay;
  10492. { Demonstrate the GetImage and PutImage commands }
  10493.  
  10494. const
  10495.   r  = 20;
  10496.   StartX = 100;
  10497.   StartY = 50;
  10498.  
  10499. var
  10500.   CurPort : ViewPortType;
  10501.  
  10502. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  10503. var
  10504.   Step : integer;
  10505. begin
  10506.   Step := Random(2*r);
  10507.   if Odd(Step) then
  10508.     Step := -Step;
  10509.   X := X + Step;
  10510.   Step := Random(r);
  10511.   if Odd(Step) then
  10512.     Step := -Step;
  10513.   Y := Y + Step;
  10514.  
  10515.   { Make saucer bounce off viewport walls }
  10516.   with CurPort do
  10517.   begin
  10518.     if (x1 + X + Width - 1 > x2) then
  10519.       X := x2-x1 - Width + 1
  10520.     else
  10521.       if (X < 0) then
  10522.         X := 0;
  10523.     if (y1 + Y + Height - 1 > y2) then
  10524.       Y := y2-y1 - Height + 1
  10525.     else
  10526.       if (Y < 0) then
  10527.         Y := 0;
  10528.   end;
  10529. end; { MoveSaucer }
  10530.  
  10531. var
  10532.   Pausetime : word;
  10533.   Saucer    : pointer;
  10534.   X, Y      : integer;
  10535.   ulx, uly  : word;
  10536.   lrx, lry  : word;
  10537.   Size      : word;
  10538.   I         : word;
  10539. begin
  10540.   ClearDevice;
  10541.   FullPort;
  10542.  
  10543.   { PaintScreen }
  10544.   ClearDevice;
  10545.   MainWindow('GetImage / PutImage Demonstration');
  10546.   StatusLine('Esc aborts or press a key...');
  10547.   GetViewSettings(CurPort);
  10548.  
  10549.   { DrawSaucer }
  10550.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  10551.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  10552.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  10553.   Circle(StartX+10, StartY-12, 2);
  10554.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  10555.   Circle(StartX-10, StartY-12, 2);
  10556.   SetFillStyle(SolidFill, MaxColor);
  10557.   FloodFill(StartX+1, StartY+4, GetColor);
  10558.  
  10559.   { ReadSaucerImage }
  10560.   ulx := StartX-(r+1);
  10561.   uly := StartY-14;
  10562.   lrx := StartX+(r+1);
  10563.   lry := StartY+(r div 3)+3;
  10564.  
  10565.   Size := ImageSize(ulx, uly, lrx, lry);
  10566.   GetMem(Saucer, Size);
  10567.   GetImage(ulx, uly, lrx, lry, Saucer^);
  10568. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  10569.  
  10570.   { Plot some "stars" }
  10571.   for I := 1 to 1000 do
  10572.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  10573.   X := MaxX div 2;
  10574.   Y := MaxY div 2;
  10575.   PauseTime := 70;
  10576.  
  10577.   { Move the saucer around }
  10578.   repeat
  10579. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  10580.      Delay(PauseTime);
  10581. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  10582.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  10583.   until KeyPressed;
  10584.   FreeMem(Saucer, size);
  10585.   WaitToGo;
  10586. end; { PutImagePlay }
  10587.  
  10588. procedure PolyPlay;
  10589. { Draw random polygons with random fill styles on the screen }
  10590. const
  10591.   MaxPts = 5;
  10592. type
  10593.   PolygonType = array[1..MaxPts] of PointType;
  10594. var
  10595.   Poly : PolygonType;
  10596.   I, Color : word;
  10597. begin
  10598.   MainWindow('FillPoly demonstration');
  10599.   StatusLine('Esc aborts or press a key...');
  10600.   repeat
  10601.     Color := RandColor;
  10602.     SetFillStyle(Random(11)+1, Color);
  10603.     SetColor(Color);
  10604.     for I := 1 to MaxPts do
  10605.       with Poly[I] do
  10606.       begin
  10607.         X := Random(MaxX);
  10608.         Y := Random(MaxY);
  10609.       end;
  10610.     FillPoly(MaxPts, Poly);
  10611.   until KeyPressed;
  10612.   WaitToGo;
  10613. end; { PolyPlay }
  10614.  
  10615. procedure FillStylePlay;
  10616. { Display all of the predefined fill styles available }
  10617. var
  10618.   Style    : word;
  10619.   Width    : word;
  10620.   Height   : word;
  10621.   X, Y     : word;
  10622.   I, J     : word;
  10623.   ViewInfo : ViewPortType;
  10624.  
  10625. procedure DrawBox(X, Y : word);
  10626. begin
  10627.   SetFillStyle(Style, MaxColor);
  10628.   with ViewInfo do
  10629.     Bar(X, Y, X+Width, Y+Height);
  10630.   Rectangle(X, Y, X+Width, Y+Height);
  10631.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  10632.   Inc(Style);
  10633. end; { DrawBox }
  10634.  
  10635. begin
  10636.   MainWindow('Pre-defined fill styles');
  10637.   GetViewSettings(ViewInfo);
  10638.   with ViewInfo do
  10639.   begin
  10640.     Width := 2 * ((x2+1) div 13);
  10641.     Height := 2 * ((y2-10) div 10);
  10642.   end;
  10643.   X := Width div 2;
  10644.   Y := Height div 2;
  10645.   Style := 0;
  10646.   for J := 1 to 3 do
  10647.   begin
  10648.     for I := 1 to 4 do
  10649.     begin
  10650.       DrawBox(X, Y);
  10651.       Inc(X, (Width div 2) * 3);
  10652.     end;
  10653.     X := Width div 2;
  10654.     Inc(Y, (Height div 2) * 3);
  10655.   end;
  10656.   SetTextJustify(LeftText, TopText);
  10657.   WaitToGo;
  10658. end; { FillStylePlay }
  10659.  
  10660. procedure FillPatternPlay;
  10661. { Display some user defined fill patterns }
  10662. const
  10663.   Patterns : array[0..11] of FillPatternType = (
  10664.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  10665.             OldColor which has a path of pixels of OldColor or NewColor
  10666.             with sides touching back to the seed point, (XSeed, YSeed).
  10667.             Therefore, only pixels of OldColor are modified and no other
  10668.             information is changed.
  10669.  
  10670.             SEE ALSO
  10671.  
  10672.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  10673.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  10674.             SETVIEW
  10675.  
  10676.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  10677.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  10678.             IF WHICHVGA = 0 THEN STOP
  10679.             DUMMY=RES640
  10680.             SETVIEW 100, 100, 539, 379
  10681.             FILLVIEW 10
  10682.             WHILE INKEY$ = ""
  10683.             WEND
  10684.             VIDEOMODESET VMODE
  10685.             END
  10686.  
  10687.  
  10688.  
  10689.  
  10690.  
  10691.  
  10692.  
  10693.  
  10694.  
  10695.  
  10696.  
  10697.  
  10698.  
  10699.  
  10700.  
  10701.  
  10702.                                                                          63
  10703.  
  10704.  
  10705.  
  10706.  
  10707.  
  10708.  
  10709.           FONTGETINFO
  10710.  
  10711.             PROTOTYPE
  10712.  
  10713.             SUB FONTGETINFO (Width%, Height%)
  10714.  
  10715.             INPUT
  10716.  
  10717.             no input parameters
  10718.     WEND
  10719.             MOUSEEXIT
  10720.             VIDEOMODESET VMODE
  10721.             END
  10722.  
  10723.  
  10724.  
  10725.  
  10726.  
  10727.  
  10728.  
  10729.  
  10730.  
  10731.  
  10732.  
  10733.  
  10734.  
  10735.  
  10736.  
  10737.  
  10738.  
  10739.  
  10740.  
  10741.  
  10742.  
  10743.  
  10744.  
  10745.  
  10746.  
  10747.  
  10748.  
  10749.  
  10750.  
  10751.  
  10752.  
  10753.  
  10754.  
  10755.  
  10756.  
  10757.  
  10758.  
  10759.  
  10760.  
  10761.  
  10762.                                                                          86
  10763.  
  10764.  
  10765.  
  10766.  
  10767.  
  10768.  
  10769.           MOUSECURSORDEFAULT
  10770.  
  10771.             PROTOTYPE
  10772.  
  10773.             SUB MOUSECURSORDEFAULT ()
  10774.  
  10775.             INPUT
  10776.  
  10777.             no input parameters
  10778.  
  10779.             OUTPUT
  10780.  
  10781.             no value returned
  10782.  
  10783.             USAGE
  10784.  
  10785.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  10786.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  10787. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  10788. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  10789. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  10790. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  10791. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  10792. $╤
  10793. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  10794. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  10795. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  10796. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  10797. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  10798. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  10799. ░£▒
  10800. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  10801. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  10802.       end;
  10803.     end;
  10804.   end;
  10805.   WaitToGo;
  10806. end; { UserLineStylePlay }
  10807.  
  10808.  
  10809. procedure SayGoodbye;
  10810. { Say goodbye and then exit the program }
  10811. var
  10812.   ViewInfo : ViewPortType;
  10813. begin
  10814.   MainWindow('');
  10815.   GetViewSettings(ViewInfo);
  10816.   SetTextStyle(TriplexFont, HorizDir, 4);
  10817.   SetTextJustify(CenterText, CenterText);
  10818.   with ViewInfo do
  10819.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  10820.   StatusLine('Press any key to quit...');
  10821.   repeat until KeyPressed;
  10822. end; { SayGoodbye }
  10823.  
  10824.  
  10825. PROCEDURE SelectMode;
  10826. VAR
  10827.     choice1,choice2     : CHAR;
  10828.    xsize,ysize            : WORD;
  10829. BEGIN
  10830.     (* Let's select a mode *)
  10831.     ClrScr;
  10832.     WriteLn('VESADEMO:');
  10833.     WriteLn('1. 256 colors');
  10834.     WriteLn('2. 32768 colors');
  10835.     WriteLn('3. 65536 colors');
  10836.     WriteLn('4. 16777216 colors');
  10837.     WriteLn('Q uit');
  10838.     WriteLn;
  10839.     Write('Your choice: ');
  10840.     REPEAT
  10841.         ReadLn(choice1);
  10842.       IF choice1 <> '1' THEN BEGIN
  10843.           WriteLn('Sorry !');
  10844.          WriteLn('This demo wasn''t written for more as 256 colors !');
  10845.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  10846.          WriteLn('Switching to 256 colors.');
  10847.          choice1 := '1';
  10848.       END;
  10849.     UNTIL choice1 IN ['1'..'4','q'];
  10850.     IF choice1 = 'q' THEN Halt;
  10851.  
  10852.     WriteLn;
  10853.     WriteLn;
  10854.     WriteLn('a. 320x200');
  10855.     WriteLn('b. 640x480');
  10856.     WriteLn('c. 800x600');
  10857.     WriteLn('d. 1024x768');
  10858.     WriteLn('e. 1280x1024');
  10859.     WriteLn('Q uit');
  10860.     WriteLn;
  10861.     Write('Your choice: ');
  10862.     REPEAT
  10863.         ReadLn(choice2);
  10864.     UNTIL choice2 IN ['a'..'e','q'];
  10865.     IF choice2 = 'q' THEN Halt;
  10866.  
  10867.     CASE choice2 OF
  10868.         'a' : BEGIN
  10869.             xsize := 320;
  10870.             ysize := 200;
  10871.         END;
  10872.         'b' : BEGIN
  10873.             xsize := 640;
  10874.             ysize := 480;
  10875.         END;
  10876.         'c' : BEGIN
  10877.             xsize := 800;
  10878.             ysize := 600;
  10879.         END;
  10880.         'd' : BEGIN
  10881.             xsize := 1024;
  10882.             ysize := 768;
  10883.         END;
  10884.         'e' : BEGIN
  10885.             xsize := 1280;
  10886.             ysize := 1024;
  10887.         END;
  10888.     END;
  10889.     CASE choice1 OF
  10890.         '1' : mode := FindVesaMode(xsize,ysize,8);
  10891.         '2' : mode := FindVesaMode(xsize,ysize,15);
  10892.         '3' : mode := FindVesaMode(xsize,ysize,16);
  10893.         '4' : mode := FindVesaMode(xsize,ysize,24);
  10894.     END;
  10895.     IF mode = 0 THEN BEGIN
  10896.         WriteLn('No such mode could be found !');
  10897.         WriteLn('Switching to to 320x200.');
  10898.         ReadKey;
  10899.         mode := V320x200x256;
  10900.     END;
  10901. END;
  10902.  
  10903. begin { program body }
  10904.   SelectMode;
  10905.   Initialize;
  10906.   ReportStatus;
  10907.  
  10908. {  AspectRatioPlay; }
  10909.   FillEllipsePlay;
  10910.   SectorPlay;
  10911.   WriteModePlay;
  10912.  
  10913.   ColorPlay;
  10914.   { PalettePlay only intended to work on these drivers: }
  10915.   if (GraphDriver = EGA) or
  10916.       (GraphDriver = EGA64) or
  10917.       (GraphDriver = VGA) then
  10918.      PalettePlay;
  10919.   PutPixelPlay;
  10920. {  PutImagePlay; }
  10921.   RandBarPlay;
  10922.   BarPlay;
  10923.   Bar3DPlay;
  10924.   ArcPlay;
  10925.   CirclePlay;
  10926.   PiePlay;
  10927.   LineToPlay;
  10928.   LineRelPlay;
  10929. {  LineStylePlay; }
  10930. {  UserLineStylePlay; }
  10931.   TextDump;
  10932.   TextPlay;
  10933.   CrtModePlay;
  10934.   FillStylePlay;
  10935.   FillPatternPlay;
  10936.   PolyPlay;
  10937.   SayGoodbye;
  10938. {  CloseGraph; }
  10939.   CloseVesa;
  10940. end.
  10941. ***************************************************
  10942.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  10943.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  10944. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  10945. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  10946. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  10947. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  10948.     Color := RandColor;
  10949.     SetColor(Color);
  10950.     SetFillStyle(Random(CloseDotFill)+1, Color);
  10951.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  10952.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  10953.   until KeyPressed;
  10954.   WaitToGo;
  10955. end; { RandBarPlay }
  10956.  
  10957. procedure ArcPlay;
  10958. { Draw random arcs on the screen }
  10959. var
  10960.   MaxRadius : word;
  10961.   EndAngle : word;
  10962.   ArcInfo : ArcCoordsType;
  10963. begin
  10964.   MainWindow('Arc / GetArcCoords demonstration');
  10965.   StatusLine('Esc aborts or press a key');
  10966.   MaxRadius := MaxY div 10;
  10967.   repeat
  10968.     SetColor(RandColor);
  10969.     EndAngle := Random(360);
  10970.     SetLineStyle(SolidLn, 0, NormWidth);
  10971.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  10972.     GetArcCoords(ArcInfo);
  10973.     with ArcInfo do
  10974.     begin
  10975.       Line(X, Y, XStart, YStart);
  10976.       Line(X, Y, Xend, Yend);
  10977.     end;
  10978.   until KeyPressed;
  10979.   WaitToGo;
  10980. end; { ArcPlay }
  10981.  
  10982. procedure PutPixelPlay;
  10983. { Demonstrate the PutPixel and GetPixel commands }
  10984. const
  10985.   Seed   = 1962; { A seed for the random number generator }
  10986.   NumPts = 2000; { The number of pixels plotted }
  10987.   Esc    = #27;
  10988. var
  10989.   I : word;
  10990.   X, Y, Color : word;
  10991.   XMax, YMax  : integer;
  10992.   ViewInfo    : ViewPortType;
  10993. begin
  10994.   MainWindow('PutPixel / GetPixel demonstration');
  10995.   StatusLine('Esc aborts or press a key...');
  10996.  
  10997.   GetViewSettings(ViewInfo);
  10998.   with ViewInfo do
  10999.   begin
  11000.     XMax := (x2-x1-1);
  11001.     YMax := (y2-y1-1);
  11002.   end;
  11003.  
  11004.   while not KeyPressed do
  11005.   begin
  11006.     { Plot random pixels }
  11007.     RandSeed := Seed;
  11008.     I := 0;
  11009.     while (not KeyPressed) and (I < NumPts) do
  11010.     begin
  11011.       Inc(I);
  11012.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  11013.     end;
  11014.  
  11015.     { Erase pixels }
  11016.     RandSeed := Seed;
  11017.     I := 0;
  11018.     while (not KeyPressed) and (I < NumPts) do
  11019.     begin
  11020.       Inc(I);
  11021.       X := Random(XMax)+1;
  11022.       Y := Random(YMax)+1;
  11023.       Color := GetPixel(X, Y);
  11024.         if Color = RandColor then
  11025.           PutPixel(X, Y, 0);
  11026.      end;
  11027.   end;
  11028.   WaitToGo;
  11029. end; { PutPixelPlay }
  11030.  
  11031. procedure PutImagePlay;
  11032. { Demonstrate the GetImage and PutImage commands }
  11033.  
  11034. const
  11035.   r  = 20;
  11036.   StartX = 100;
  11037.   StartY = 50;
  11038.  
  11039. var
  11040.   CurPort : ViewPortType;
  11041.  
  11042. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  11043. var
  11044.   Step : integer;
  11045. begin
  11046.   Step := Random(2*r);
  11047.   if Odd(Step) then
  11048.     Step := -Step;
  11049.   X := X + Step;
  11050.   Step := Random(r);
  11051.   if Odd(Step) then
  11052.     Step := -Step;
  11053.   Y := Y + Step;
  11054.  
  11055.   { Make saucer bounce off viewport walls }
  11056.   with CurPort do
  11057.   begin
  11058.     if (x1 + X + Width - 1 > x2) then
  11059.       X := x2-x1 - Width + 1
  11060.     else
  11061.       if (X < 0) then
  11062.         X := 0;
  11063.     if (y1 + Y + Height - 1 > y2) then
  11064.       Y := y2-y1 - Height + 1
  11065.     else
  11066.       if (Y < 0) then
  11067.         Y := 0;
  11068.   end;
  11069. end; { MoveSaucer }
  11070.  
  11071. var
  11072.   Pausetime : word;
  11073.   Saucer    : pointer;
  11074.   X, Y      : integer;
  11075.   ulx, uly  : word;
  11076.   lrx, lry  : word;
  11077.   Size      : word;
  11078.   I         : word;
  11079. begin
  11080.   ClearDevice;
  11081.   FullPort;
  11082.  
  11083.   { PaintScreen }
  11084.   ClearDevice;
  11085.   MainWindow('GetImage / PutImage Demonstration');
  11086.   StatusLine('Esc aborts or press a key...');
  11087.   GetViewSettings(CurPort);
  11088.  
  11089.   { DrawSaucer }
  11090.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  11091.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  11092.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  11093.   Circle(StartX+10, StartY-12, 2);
  11094.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  11095.   Circle(StartX-10, StartY-12, 2);
  11096.   SetFillStyle(SolidFill, MaxColor);
  11097.   FloodFill(StartX+1, StartY+4, GetColor);
  11098.  
  11099.   { ReadSaucerImage }
  11100.   ulx := StartX-(r+1);
  11101.   uly := StartY-14;
  11102.   lrx := StartX+(r+1);
  11103.   lry := StartY+(r div 3)+3;
  11104.  
  11105.   Size := ImageSize(ulx, uly, lrx, lry);
  11106.   GetMem(Saucer, Size);
  11107.   GetImage(ulx, uly, lrx, lry, Saucer^);
  11108. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  11109.  
  11110.   { Plot some "stars" }
  11111.   for I := 1 to 1000 do
  11112.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  11113.   X := MaxX div 2;
  11114.   Y := MaxY div 2;
  11115.   PauseTime := 70;
  11116.  
  11117.   { Move the saucer around }
  11118.   repeat
  11119. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  11120.      Delay(PauseTime);
  11121. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  11122.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  11123.   until KeyPressed;
  11124.   FreeMem(Saucer, size);
  11125.   WaitToGo;
  11126. end; { PutImagePlay }
  11127.  
  11128. procedure PolyPlay;
  11129. { Draw random polygons with random fill styles on the screen }
  11130. const
  11131.   MaxPts = 5;
  11132. type
  11133.   PolygonType = array[1..MaxPts] of PointType;
  11134. var
  11135.   Poly : PolygonType;
  11136.   I, Color : word;
  11137. begin
  11138.   MainWindow('FillPoly demonstration');
  11139.   StatusLine('Esc aborts or press a key...');
  11140.   repeat
  11141.     Color := RandColor;
  11142.     SetFillStyle(Random(11)+1, Color);
  11143.     SetColor(Color);
  11144.     for I := 1 to MaxPts do
  11145.       with Poly[I] do
  11146.       begin
  11147.         X := Random(MaxX);
  11148.         Y := Random(MaxY);
  11149.       end;
  11150.     FillPoly(MaxPts, Poly);
  11151.   until KeyPressed;
  11152.   WaitToGo;
  11153. end; { PolyPlay }
  11154.  
  11155. procedure FillStylePlay;
  11156. { Display all of the predefined fill styles available }
  11157. var
  11158.   Style    : word;
  11159.   Width    : word;
  11160.   Height   : word;
  11161.   X, Y     : word;
  11162.   I, J     : word;
  11163.   ViewInfo : ViewPortType;
  11164.  
  11165. procedure DrawBox(X, Y : word);
  11166. begin
  11167.   SetFillStyle(Style, MaxColor);
  11168.   with ViewInfo do
  11169.     Bar(X, Y, X+Width, Y+Height);
  11170.   Rectangle(X, Y, X+Width, Y+Height);
  11171.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  11172.   Inc(Style);
  11173. end; { DrawBox }
  11174.  
  11175. begin
  11176.   MainWindow('Pre-defined fill styles');
  11177.   GetViewSettings(ViewInfo);
  11178.   with ViewInfo do
  11179.   begin
  11180.     Width := 2 * ((x2+1) div 13);
  11181.     Height := 2 * ((y2-10) div 10);
  11182.   end;
  11183.   X := Width div 2;
  11184.   Y := Height div 2;
  11185.   Style := 0;
  11186.   for J := 1 to 3 do
  11187.   begin
  11188.     for I := 1 to 4 do
  11189.     begin
  11190.       DrawBox(X, Y);
  11191.       Inc(X, (Width div 2) * 3);
  11192.     end;
  11193.     X := Width div 2;
  11194.     Inc(Y, (Height div 2) * 3);
  11195.   end;
  11196.   SetTextJustify(LeftText, TopText);
  11197.   WaitToGo;
  11198. end; { FillStylePlay }
  11199.  
  11200. procedure FillPatternPlay;
  11201. { Display some user defined fill patterns }
  11202. const
  11203.   Patterns : array[0..11] of FillPatternType = (
  11204.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  11205.             OldColor which has a path of pixels of OldColor or NewColor
  11206.             with sides touching back to the seed point, (XSeed, YSeed).
  11207.             Therefore, only pixels of OldColor are modified and no other
  11208.             information is changed.
  11209.  
  11210.             SEE ALSO
  11211.  
  11212.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  11213.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  11214.             SETVIEW
  11215.  
  11216.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  11217.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  11218.             IF WHICHVGA = 0 THEN STOP
  11219.             DUMMY=RES640
  11220.             SETVIEW 100, 100, 539, 379
  11221.             FILLVIEW 10
  11222.             WHILE INKEY$ = ""
  11223.             WEND
  11224.             VIDEOMODESET VMODE
  11225.             END
  11226.  
  11227.  
  11228.  
  11229.  
  11230.  
  11231.  
  11232.  
  11233.  
  11234.  
  11235.  
  11236.  
  11237.  
  11238.  
  11239.  
  11240.  
  11241.  
  11242.                                                                          63
  11243.  
  11244.  
  11245.  
  11246.  
  11247.  
  11248.  
  11249.           FONTGETINFO
  11250.  
  11251.             PROTOTYPE
  11252.  
  11253.             SUB FONTGETINFO (Width%, Height%)
  11254.  
  11255.             INPUT
  11256.  
  11257.             no input parameters
  11258.     WEND
  11259.             MOUSEEXIT
  11260.             VIDEOMODESET VMODE
  11261.             END
  11262.  
  11263.  
  11264.  
  11265.  
  11266.  
  11267.  
  11268.  
  11269.  
  11270.  
  11271.  
  11272.  
  11273.  
  11274.  
  11275.  
  11276.  
  11277.  
  11278.  
  11279.  
  11280.  
  11281.  
  11282.  
  11283.  
  11284.  
  11285.  
  11286.  
  11287.  
  11288.  
  11289.  
  11290.  
  11291.  
  11292.  
  11293.  
  11294.  
  11295.  
  11296.  
  11297.  
  11298.  
  11299.  
  11300.  
  11301.  
  11302.                                                                          86
  11303.  
  11304.  
  11305.  
  11306.  
  11307.  
  11308.  
  11309.           MOUSECURSORDEFAULT
  11310.  
  11311.             PROTOTYPE
  11312.  
  11313.             SUB MOUSECURSORDEFAULT ()
  11314.  
  11315.             INPUT
  11316.  
  11317.             no input parameters
  11318.  
  11319.             OUTPUT
  11320.  
  11321.             no value returned
  11322.  
  11323.             USAGE
  11324.  
  11325.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  11326.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  11327. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  11328. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  11329. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  11330. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  11331. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  11332. $╤
  11333. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  11334. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  11335. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  11336. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  11337. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  11338. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  11339. ░£▒
  11340. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  11341. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  11342.       end;
  11343.     end;
  11344.   end;
  11345.   WaitToGo;
  11346. end; { UserLineStylePlay }
  11347.  
  11348.  
  11349. procedure SayGoodbye;
  11350. { Say goodbye and then exit the program }
  11351. var
  11352.   ViewInfo : ViewPortType;
  11353. begin
  11354.   MainWindow('');
  11355.   GetViewSettings(ViewInfo);
  11356.   SetTextStyle(TriplexFont, HorizDir, 4);
  11357.   SetTextJustify(CenterText, CenterText);
  11358.   with ViewInfo do
  11359.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  11360.   StatusLine('Press any key to quit...');
  11361.   repeat until KeyPressed;
  11362. end; { SayGoodbye }
  11363.  
  11364.  
  11365. PROCEDURE SelectMode;
  11366. VAR
  11367.     choice1,choice2     : CHAR;
  11368.    xsize,ysize            : WORD;
  11369. BEGIN
  11370.     (* Let's select a mode *)
  11371.     ClrScr;
  11372.     WriteLn('VESADEMO:');
  11373.     WriteLn('1. 256 colors');
  11374.     WriteLn('2. 32768 colors');
  11375.     WriteLn('3. 65536 colors');
  11376.     WriteLn('4. 16777216 colors');
  11377.     WriteLn('Q uit');
  11378.     WriteLn;
  11379.     Write('Your choice: ');
  11380.     REPEAT
  11381.         ReadLn(choice1);
  11382.       IF choice1 <> '1' THEN BEGIN
  11383.           WriteLn('Sorry !');
  11384.          WriteLn('This demo wasn''t written for more as 256 colors !');
  11385.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  11386.          WriteLn('Switching to 256 colors.');
  11387.          choice1 := '1';
  11388.       END;
  11389.     UNTIL choice1 IN ['1'..'4','q'];
  11390.     IF choice1 = 'q' THEN Halt;
  11391.  
  11392.     WriteLn;
  11393.     WriteLn;
  11394.     WriteLn('a. 320x200');
  11395.     WriteLn('b. 640x480');
  11396.     WriteLn('c. 800x600');
  11397.     WriteLn('d. 1024x768');
  11398.     WriteLn('e. 1280x1024');
  11399.     WriteLn('Q uit');
  11400.     WriteLn;
  11401.     Write('Your choice: ');
  11402.     REPEAT
  11403.         ReadLn(choice2);
  11404.     UNTIL choice2 IN ['a'..'e','q'];
  11405.     IF choice2 = 'q' THEN Halt;
  11406.  
  11407.     CASE choice2 OF
  11408.         'a' : BEGIN
  11409.             xsize := 320;
  11410.             ysize := 200;
  11411.         END;
  11412.         'b' : BEGIN
  11413.             xsize := 640;
  11414.             ysize := 480;
  11415.         END;
  11416.         'c' : BEGIN
  11417.             xsize := 800;
  11418.             ysize := 600;
  11419.         END;
  11420.         'd' : BEGIN
  11421.             xsize := 1024;
  11422.             ysize := 768;
  11423.         END;
  11424.         'e' : BEGIN
  11425.             xsize := 1280;
  11426.             ysize := 1024;
  11427.         END;
  11428.     END;
  11429.     CASE choice1 OF
  11430.         '1' : mode := FindVesaMode(xsize,ysize,8);
  11431.         '2' : mode := FindVesaMode(xsize,ysize,15);
  11432.         '3' : mode := FindVesaMode(xsize,ysize,16);
  11433.         '4' : mode := FindVesaMode(xsize,ysize,24);
  11434.     END;
  11435.     IF mode = 0 THEN BEGIN
  11436.         WriteLn('No such mode could be found !');
  11437.         WriteLn('Switching to to 320x200.');
  11438.         ReadKey;
  11439.         mode := V320x200x256;
  11440.     END;
  11441. END;
  11442.  
  11443. begin { program body }
  11444.   SelectMode;
  11445.   Initialize;
  11446.   ReportStatus;
  11447.  
  11448. {  AspectRatioPlay; }
  11449.   FillEllipsePlay;
  11450.   SectorPlay;
  11451.   WriteModePlay;
  11452.  
  11453.   ColorPlay;
  11454.   { PalettePlay only intended to work on these drivers: }
  11455.   if (GraphDriver = EGA) or
  11456.       (GraphDriver = EGA64) or
  11457.       (GraphDriver = VGA) then
  11458.      PalettePlay;
  11459.   PutPixelPlay;
  11460. {  PutImagePlay; }
  11461.   RandBarPlay;
  11462.   BarPlay;
  11463.   Bar3DPlay;
  11464.   ArcPlay;
  11465.   CirclePlay;
  11466.   PiePlay;
  11467.   LineToPlay;
  11468.   LineRelPlay;
  11469. {  LineStylePlay; }
  11470. {  UserLineStylePlay; }
  11471.   TextDump;
  11472.   TextPlay;
  11473.   CrtModePlay;
  11474.   FillStylePlay;
  11475.   FillPatternPlay;
  11476.   PolyPlay;
  11477.   SayGoodbye;
  11478. {  CloseGraph; }
  11479.   CloseVesa;
  11480. end.
  11481. ***************************************************
  11482.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  11483.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  11484. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  11485. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  11486. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  11487. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  11488.     Color := RandColor;
  11489.     SetColor(Color);
  11490.     SetFillStyle(Random(CloseDotFill)+1, Color);
  11491.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  11492.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  11493.   until KeyPressed;
  11494.   WaitToGo;
  11495. end; { RandBarPlay }
  11496.  
  11497. procedure ArcPlay;
  11498. { Draw random arcs on the screen }
  11499. var
  11500.   MaxRadius : word;
  11501.   EndAngle : word;
  11502.   ArcInfo : ArcCoordsType;
  11503. begin
  11504.   MainWindow('Arc / GetArcCoords demonstration');
  11505.   StatusLine('Esc aborts or press a key');
  11506.   MaxRadius := MaxY div 10;
  11507.   repeat
  11508.     SetColor(RandColor);
  11509.     EndAngle := Random(360);
  11510.     SetLineStyle(SolidLn, 0, NormWidth);
  11511.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  11512.     GetArcCoords(ArcInfo);
  11513.     with ArcInfo do
  11514.     begin
  11515.       Line(X, Y, XStart, YStart);
  11516.       Line(X, Y, Xend, Yend);
  11517.     end;
  11518.   until KeyPressed;
  11519.   WaitToGo;
  11520. end; { ArcPlay }
  11521.  
  11522. procedure PutPixelPlay;
  11523. { Demonstrate the PutPixel and GetPixel commands }
  11524. const
  11525.   Seed   = 1962; { A seed for the random number generator }
  11526.   NumPts = 2000; { The number of pixels plotted }
  11527.   Esc    = #27;
  11528. var
  11529.   I : word;
  11530.   X, Y, Color : word;
  11531.   XMax, YMax  : integer;
  11532.   ViewInfo    : ViewPortType;
  11533. begin
  11534.   MainWindow('PutPixel / GetPixel demonstration');
  11535.   StatusLine('Esc aborts or press a key...');
  11536.  
  11537.   GetViewSettings(ViewInfo);
  11538.   with ViewInfo do
  11539.   begin
  11540.     XMax := (x2-x1-1);
  11541.     YMax := (y2-y1-1);
  11542.   end;
  11543.  
  11544.   while not KeyPressed do
  11545.   begin
  11546.     { Plot random pixels }
  11547.     RandSeed := Seed;
  11548.     I := 0;
  11549.     while (not KeyPressed) and (I < NumPts) do
  11550.     begin
  11551.       Inc(I);
  11552.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  11553.     end;
  11554.  
  11555.     { Erase pixels }
  11556.     RandSeed := Seed;
  11557.     I := 0;
  11558.     while (not KeyPressed) and (I < NumPts) do
  11559.     begin
  11560.       Inc(I);
  11561.       X := Random(XMax)+1;
  11562.       Y := Random(YMax)+1;
  11563.       Color := GetPixel(X, Y);
  11564.         if Color = RandColor then
  11565.           PutPixel(X, Y, 0);
  11566.      end;
  11567.   end;
  11568.   WaitToGo;
  11569. end; { PutPixelPlay }
  11570.  
  11571. procedure PutImagePlay;
  11572. { Demonstrate the GetImage and PutImage commands }
  11573.  
  11574. const
  11575.   r  = 20;
  11576.   StartX = 100;
  11577.   StartY = 50;
  11578.  
  11579. var
  11580.   CurPort : ViewPortType;
  11581.  
  11582. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  11583. var
  11584.   Step : integer;
  11585. begin
  11586.   Step := Random(2*r);
  11587.   if Odd(Step) then
  11588.     Step := -Step;
  11589.   X := X + Step;
  11590.   Step := Random(r);
  11591.   if Odd(Step) then
  11592.     Step := -Step;
  11593.   Y := Y + Step;
  11594.  
  11595.   { Make saucer bounce off viewport walls }
  11596.   with CurPort do
  11597.   begin
  11598.     if (x1 + X + Width - 1 > x2) then
  11599.       X := x2-x1 - Width + 1
  11600.     else
  11601.       if (X < 0) then
  11602.         X := 0;
  11603.     if (y1 + Y + Height - 1 > y2) then
  11604.       Y := y2-y1 - Height + 1
  11605.     else
  11606.       if (Y < 0) then
  11607.         Y := 0;
  11608.   end;
  11609. end; { MoveSaucer }
  11610.  
  11611. var
  11612.   Pausetime : word;
  11613.   Saucer    : pointer;
  11614.   X, Y      : integer;
  11615.   ulx, uly  : word;
  11616.   lrx, lry  : word;
  11617.   Size      : word;
  11618.   I         : word;
  11619. begin
  11620.   ClearDevice;
  11621.   FullPort;
  11622.  
  11623.   { PaintScreen }
  11624.   ClearDevice;
  11625.   MainWindow('GetImage / PutImage Demonstration');
  11626.   StatusLine('Esc aborts or press a key...');
  11627.   GetViewSettings(CurPort);
  11628.  
  11629.   { DrawSaucer }
  11630.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  11631.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  11632.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  11633.   Circle(StartX+10, StartY-12, 2);
  11634.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  11635.   Circle(StartX-10, StartY-12, 2);
  11636.   SetFillStyle(SolidFill, MaxColor);
  11637.   FloodFill(StartX+1, StartY+4, GetColor);
  11638.  
  11639.   { ReadSaucerImage }
  11640.   ulx := StartX-(r+1);
  11641.   uly := StartY-14;
  11642.   lrx := StartX+(r+1);
  11643.   lry := StartY+(r div 3)+3;
  11644.  
  11645.   Size := ImageSize(ulx, uly, lrx, lry);
  11646.   GetMem(Saucer, Size);
  11647.   GetImage(ulx, uly, lrx, lry, Saucer^);
  11648. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  11649.  
  11650.   { Plot some "stars" }
  11651.   for I := 1 to 1000 do
  11652.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  11653.   X := MaxX div 2;
  11654.   Y := MaxY div 2;
  11655.   PauseTime := 70;
  11656.  
  11657.   { Move the saucer around }
  11658.   repeat
  11659. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  11660.      Delay(PauseTime);
  11661. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  11662.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  11663.   until KeyPressed;
  11664.   FreeMem(Saucer, size);
  11665.   WaitToGo;
  11666. end; { PutImagePlay }
  11667.  
  11668. procedure PolyPlay;
  11669. { Draw random polygons with random fill styles on the screen }
  11670. const
  11671.   MaxPts = 5;
  11672. type
  11673.   PolygonType = array[1..MaxPts] of PointType;
  11674. var
  11675.   Poly : PolygonType;
  11676.   I, Color : word;
  11677. begin
  11678.   MainWindow('FillPoly demonstration');
  11679.   StatusLine('Esc aborts or press a key...');
  11680.   repeat
  11681.     Color := RandColor;
  11682.     SetFillStyle(Random(11)+1, Color);
  11683.     SetColor(Color);
  11684.     for I := 1 to MaxPts do
  11685.       with Poly[I] do
  11686.       begin
  11687.         X := Random(MaxX);
  11688.         Y := Random(MaxY);
  11689.       end;
  11690.     FillPoly(MaxPts, Poly);
  11691.   until KeyPressed;
  11692.   WaitToGo;
  11693. end; { PolyPlay }
  11694.  
  11695. procedure FillStylePlay;
  11696. { Display all of the predefined fill styles available }
  11697. var
  11698.   Style    : word;
  11699.   Width    : word;
  11700.   Height   : word;
  11701.   X, Y     : word;
  11702.   I, J     : word;
  11703.   ViewInfo : ViewPortType;
  11704.  
  11705. procedure DrawBox(X, Y : word);
  11706. begin
  11707.   SetFillStyle(Style, MaxColor);
  11708.   with ViewInfo do
  11709.     Bar(X, Y, X+Width, Y+Height);
  11710.   Rectangle(X, Y, X+Width, Y+Height);
  11711.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  11712.   Inc(Style);
  11713. end; { DrawBox }
  11714.  
  11715. begin
  11716.   MainWindow('Pre-defined fill styles');
  11717.   GetViewSettings(ViewInfo);
  11718.   with ViewInfo do
  11719.   begin
  11720.     Width := 2 * ((x2+1) div 13);
  11721.     Height := 2 * ((y2-10) div 10);
  11722.   end;
  11723.   X := Width div 2;
  11724.   Y := Height div 2;
  11725.   Style := 0;
  11726.   for J := 1 to 3 do
  11727.   begin
  11728.     for I := 1 to 4 do
  11729.     begin
  11730.       DrawBox(X, Y);
  11731.       Inc(X, (Width div 2) * 3);
  11732.     end;
  11733.     X := Width div 2;
  11734.     Inc(Y, (Height div 2) * 3);
  11735.   end;
  11736.   SetTextJustify(LeftText, TopText);
  11737.   WaitToGo;
  11738. end; { FillStylePlay }
  11739.  
  11740. procedure FillPatternPlay;
  11741. { Display some user defined fill patterns }
  11742. const
  11743.   Patterns : array[0..11] of FillPatternType = (
  11744.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  11745.             OldColor which has a path of pixels of OldColor or NewColor
  11746.             with sides touching back to the seed point, (XSeed, YSeed).
  11747.             Therefore, only pixels of OldColor are modified and no other
  11748.             information is changed.
  11749.  
  11750.             SEE ALSO
  11751.  
  11752.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  11753.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  11754.             SETVIEW
  11755.  
  11756.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  11757.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  11758.             IF WHICHVGA = 0 THEN STOP
  11759.             DUMMY=RES640
  11760.             SETVIEW 100, 100, 539, 379
  11761.             FILLVIEW 10
  11762.             WHILE INKEY$ = ""
  11763.             WEND
  11764.             VIDEOMODESET VMODE
  11765.             END
  11766.  
  11767.  
  11768.  
  11769.  
  11770.  
  11771.  
  11772.  
  11773.  
  11774.  
  11775.  
  11776.  
  11777.  
  11778.  
  11779.  
  11780.  
  11781.  
  11782.                                                                          63
  11783.  
  11784.  
  11785.  
  11786.  
  11787.  
  11788.  
  11789.           FONTGETINFO
  11790.  
  11791.             PROTOTYPE
  11792.  
  11793.             SUB FONTGETINFO (Width%, Height%)
  11794.  
  11795.             INPUT
  11796.  
  11797.             no input parameters
  11798.     WEND
  11799.             MOUSEEXIT
  11800.             VIDEOMODESET VMODE
  11801.             END
  11802.  
  11803.  
  11804.  
  11805.  
  11806.  
  11807.  
  11808.  
  11809.  
  11810.  
  11811.  
  11812.  
  11813.  
  11814.  
  11815.  
  11816.  
  11817.  
  11818.  
  11819.  
  11820.  
  11821.  
  11822.  
  11823.  
  11824.  
  11825.  
  11826.  
  11827.  
  11828.  
  11829.  
  11830.  
  11831.  
  11832.  
  11833.  
  11834.  
  11835.  
  11836.  
  11837.  
  11838.  
  11839.  
  11840.  
  11841.  
  11842.                                                                          86
  11843.  
  11844.  
  11845.  
  11846.  
  11847.  
  11848.  
  11849.           MOUSECURSORDEFAULT
  11850.  
  11851.             PROTOTYPE
  11852.  
  11853.             SUB MOUSECURSORDEFAULT ()
  11854.  
  11855.             INPUT
  11856.  
  11857.             no input parameters
  11858.  
  11859.             OUTPUT
  11860.  
  11861.             no value returned
  11862.  
  11863.             USAGE
  11864.  
  11865.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  11866.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  11867. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  11868. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  11869. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  11870. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  11871. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  11872. $╤
  11873. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  11874. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  11875. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  11876. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  11877. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  11878. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  11879. ░£▒
  11880. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  11881. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  11882.       end;
  11883.     end;
  11884.   end;
  11885.   WaitToGo;
  11886. end; { UserLineStylePlay }
  11887.  
  11888.  
  11889. procedure SayGoodbye;
  11890. { Say goodbye and then exit the program }
  11891. var
  11892.   ViewInfo : ViewPortType;
  11893. begin
  11894.   MainWindow('');
  11895.   GetViewSettings(ViewInfo);
  11896.   SetTextStyle(TriplexFont, HorizDir, 4);
  11897.   SetTextJustify(CenterText, CenterText);
  11898.   with ViewInfo do
  11899.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  11900.   StatusLine('Press any key to quit...');
  11901.   repeat until KeyPressed;
  11902. end; { SayGoodbye }
  11903.  
  11904.  
  11905. PROCEDURE SelectMode;
  11906. VAR
  11907.     choice1,choice2     : CHAR;
  11908.    xsize,ysize            : WORD;
  11909. BEGIN
  11910.     (* Let's select a mode *)
  11911.     ClrScr;
  11912.     WriteLn('VESADEMO:');
  11913.     WriteLn('1. 256 colors');
  11914.     WriteLn('2. 32768 colors');
  11915.     WriteLn('3. 65536 colors');
  11916.     WriteLn('4. 16777216 colors');
  11917.     WriteLn('Q uit');
  11918.     WriteLn;
  11919.     Write('Your choice: ');
  11920.     REPEAT
  11921.         ReadLn(choice1);
  11922.       IF choice1 <> '1' THEN BEGIN
  11923.           WriteLn('Sorry !');
  11924.          WriteLn('This demo wasn''t written for more as 256 colors !');
  11925.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  11926.          WriteLn('Switching to 256 colors.');
  11927.          choice1 := '1';
  11928.       END;
  11929.     UNTIL choice1 IN ['1'..'4','q'];
  11930.     IF choice1 = 'q' THEN Halt;
  11931.  
  11932.     WriteLn;
  11933.     WriteLn;
  11934.     WriteLn('a. 320x200');
  11935.     WriteLn('b. 640x480');
  11936.     WriteLn('c. 800x600');
  11937.     WriteLn('d. 1024x768');
  11938.     WriteLn('e. 1280x1024');
  11939.     WriteLn('Q uit');
  11940.     WriteLn;
  11941.     Write('Your choice: ');
  11942.     REPEAT
  11943.         ReadLn(choice2);
  11944.     UNTIL choice2 IN ['a'..'e','q'];
  11945.     IF choice2 = 'q' THEN Halt;
  11946.  
  11947.     CASE choice2 OF
  11948.         'a' : BEGIN
  11949.             xsize := 320;
  11950.             ysize := 200;
  11951.         END;
  11952.         'b' : BEGIN
  11953.             xsize := 640;
  11954.             ysize := 480;
  11955.         END;
  11956.         'c' : BEGIN
  11957.             xsize := 800;
  11958.             ysize := 600;
  11959.         END;
  11960.         'd' : BEGIN
  11961.             xsize := 1024;
  11962.             ysize := 768;
  11963.         END;
  11964.         'e' : BEGIN
  11965.             xsize := 1280;
  11966.             ysize := 1024;
  11967.         END;
  11968.     END;
  11969.     CASE choice1 OF
  11970.         '1' : mode := FindVesaMode(xsize,ysize,8);
  11971.         '2' : mode := FindVesaMode(xsize,ysize,15);
  11972.         '3' : mode := FindVesaMode(xsize,ysize,16);
  11973.         '4' : mode := FindVesaMode(xsize,ysize,24);
  11974.     END;
  11975.     IF mode = 0 THEN BEGIN
  11976.         WriteLn('No such mode could be found !');
  11977.         WriteLn('Switching to to 320x200.');
  11978.         ReadKey;
  11979.         mode := V320x200x256;
  11980.     END;
  11981. END;
  11982.  
  11983. begin { program body }
  11984.   SelectMode;
  11985.   Initialize;
  11986.   ReportStatus;
  11987.  
  11988. {  AspectRatioPlay; }
  11989.   FillEllipsePlay;
  11990.   SectorPlay;
  11991.   WriteModePlay;
  11992.  
  11993.   ColorPlay;
  11994.   { PalettePlay only intended to work on these drivers: }
  11995.   if (GraphDriver = EGA) or
  11996.       (GraphDriver = EGA64) or
  11997.       (GraphDriver = VGA) then
  11998.      PalettePlay;
  11999.   PutPixelPlay;
  12000. {  PutImagePlay; }
  12001.   RandBarPlay;
  12002.   BarPlay;
  12003.   Bar3DPlay;
  12004.   ArcPlay;
  12005.   CirclePlay;
  12006.   PiePlay;
  12007.   LineToPlay;
  12008.   LineRelPlay;
  12009. {  LineStylePlay; }
  12010. {  UserLineStylePlay; }
  12011.   TextDump;
  12012.   TextPlay;
  12013.   CrtModePlay;
  12014.   FillStylePlay;
  12015.   FillPatternPlay;
  12016.   PolyPlay;
  12017.   SayGoodbye;
  12018. {  CloseGraph; }
  12019.   CloseVesa;
  12020. end.
  12021. ***************************************************
  12022.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  12023.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  12024. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  12025. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  12026. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  12027. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  12028.     Color := RandColor;
  12029.     SetColor(Color);
  12030.     SetFillStyle(Random(CloseDotFill)+1, Color);
  12031.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  12032.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  12033.   until KeyPressed;
  12034.   WaitToGo;
  12035. end; { RandBarPlay }
  12036.  
  12037. procedure ArcPlay;
  12038. { Draw random arcs on the screen }
  12039. var
  12040.   MaxRadius : word;
  12041.   EndAngle : word;
  12042.   ArcInfo : ArcCoordsType;
  12043. begin
  12044.   MainWindow('Arc / GetArcCoords demonstration');
  12045.   StatusLine('Esc aborts or press a key');
  12046.   MaxRadius := MaxY div 10;
  12047.   repeat
  12048.     SetColor(RandColor);
  12049.     EndAngle := Random(360);
  12050.     SetLineStyle(SolidLn, 0, NormWidth);
  12051.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  12052.     GetArcCoords(ArcInfo);
  12053.     with ArcInfo do
  12054.     begin
  12055.       Line(X, Y, XStart, YStart);
  12056.       Line(X, Y, Xend, Yend);
  12057.     end;
  12058.   until KeyPressed;
  12059.   WaitToGo;
  12060. end; { ArcPlay }
  12061.  
  12062. procedure PutPixelPlay;
  12063. { Demonstrate the PutPixel and GetPixel commands }
  12064. const
  12065.   Seed   = 1962; { A seed for the random number generator }
  12066.   NumPts = 2000; { The number of pixels plotted }
  12067.   Esc    = #27;
  12068. var
  12069.   I : word;
  12070.   X, Y, Color : word;
  12071.   XMax, YMax  : integer;
  12072.   ViewInfo    : ViewPortType;
  12073. begin
  12074.   MainWindow('PutPixel / GetPixel demonstration');
  12075.   StatusLine('Esc aborts or press a key...');
  12076.  
  12077.   GetViewSettings(ViewInfo);
  12078.   with ViewInfo do
  12079.   begin
  12080.     XMax := (x2-x1-1);
  12081.     YMax := (y2-y1-1);
  12082.   end;
  12083.  
  12084.   while not KeyPressed do
  12085.   begin
  12086.     { Plot random pixels }
  12087.     RandSeed := Seed;
  12088.     I := 0;
  12089.     while (not KeyPressed) and (I < NumPts) do
  12090.     begin
  12091.       Inc(I);
  12092.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  12093.     end;
  12094.  
  12095.     { Erase pixels }
  12096.     RandSeed := Seed;
  12097.     I := 0;
  12098.     while (not KeyPressed) and (I < NumPts) do
  12099.     begin
  12100.       Inc(I);
  12101.       X := Random(XMax)+1;
  12102.       Y := Random(YMax)+1;
  12103.       Color := GetPixel(X, Y);
  12104.         if Color = RandColor then
  12105.           PutPixel(X, Y, 0);
  12106.      end;
  12107.   end;
  12108.   WaitToGo;
  12109. end; { PutPixelPlay }
  12110.  
  12111. procedure PutImagePlay;
  12112. { Demonstrate the GetImage and PutImage commands }
  12113.  
  12114. const
  12115.   r  = 20;
  12116.   StartX = 100;
  12117.   StartY = 50;
  12118.  
  12119. var
  12120.   CurPort : ViewPortType;
  12121.  
  12122. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  12123. var
  12124.   Step : integer;
  12125. begin
  12126.   Step := Random(2*r);
  12127.   if Odd(Step) then
  12128.     Step := -Step;
  12129.   X := X + Step;
  12130.   Step := Random(r);
  12131.   if Odd(Step) then
  12132.     Step := -Step;
  12133.   Y := Y + Step;
  12134.  
  12135.   { Make saucer bounce off viewport walls }
  12136.   with CurPort do
  12137.   begin
  12138.     if (x1 + X + Width - 1 > x2) then
  12139.       X := x2-x1 - Width + 1
  12140.     else
  12141.       if (X < 0) then
  12142.         X := 0;
  12143.     if (y1 + Y + Height - 1 > y2) then
  12144.       Y := y2-y1 - Height + 1
  12145.     else
  12146.       if (Y < 0) then
  12147.         Y := 0;
  12148.   end;
  12149. end; { MoveSaucer }
  12150.  
  12151. var
  12152.   Pausetime : word;
  12153.   Saucer    : pointer;
  12154.   X, Y      : integer;
  12155.   ulx, uly  : word;
  12156.   lrx, lry  : word;
  12157.   Size      : word;
  12158.   I         : word;
  12159. begin
  12160.   ClearDevice;
  12161.   FullPort;
  12162.  
  12163.   { PaintScreen }
  12164.   ClearDevice;
  12165.   MainWindow('GetImage / PutImage Demonstration');
  12166.   StatusLine('Esc aborts or press a key...');
  12167.   GetViewSettings(CurPort);
  12168.  
  12169.   { DrawSaucer }
  12170.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  12171.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  12172.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  12173.   Circle(StartX+10, StartY-12, 2);
  12174.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  12175.   Circle(StartX-10, StartY-12, 2);
  12176.   SetFillStyle(SolidFill, MaxColor);
  12177.   FloodFill(StartX+1, StartY+4, GetColor);
  12178.  
  12179.   { ReadSaucerImage }
  12180.   ulx := StartX-(r+1);
  12181.   uly := StartY-14;
  12182.   lrx := StartX+(r+1);
  12183.   lry := StartY+(r div 3)+3;
  12184.  
  12185.   Size := ImageSize(ulx, uly, lrx, lry);
  12186.   GetMem(Saucer, Size);
  12187.   GetImage(ulx, uly, lrx, lry, Saucer^);
  12188. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  12189.  
  12190.   { Plot some "stars" }
  12191.   for I := 1 to 1000 do
  12192.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  12193.   X := MaxX div 2;
  12194.   Y := MaxY div 2;
  12195.   PauseTime := 70;
  12196.  
  12197.   { Move the saucer around }
  12198.   repeat
  12199. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  12200.      Delay(PauseTime);
  12201. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  12202.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  12203.   until KeyPressed;
  12204.   FreeMem(Saucer, size);
  12205.   WaitToGo;
  12206. end; { PutImagePlay }
  12207.  
  12208. procedure PolyPlay;
  12209. { Draw random polygons with random fill styles on the screen }
  12210. const
  12211.   MaxPts = 5;
  12212. type
  12213.   PolygonType = array[1..MaxPts] of PointType;
  12214. var
  12215.   Poly : PolygonType;
  12216.   I, Color : word;
  12217. begin
  12218.   MainWindow('FillPoly demonstration');
  12219.   StatusLine('Esc aborts or press a key...');
  12220.   repeat
  12221.     Color := RandColor;
  12222.     SetFillStyle(Random(11)+1, Color);
  12223.     SetColor(Color);
  12224.     for I := 1 to MaxPts do
  12225.       with Poly[I] do
  12226.       begin
  12227.         X := Random(MaxX);
  12228.         Y := Random(MaxY);
  12229.       end;
  12230.     FillPoly(MaxPts, Poly);
  12231.   until KeyPressed;
  12232.   WaitToGo;
  12233. end; { PolyPlay }
  12234.  
  12235. procedure FillStylePlay;
  12236. { Display all of the predefined fill styles available }
  12237. var
  12238.   Style    : word;
  12239.   Width    : word;
  12240.   Height   : word;
  12241.   X, Y     : word;
  12242.   I, J     : word;
  12243.   ViewInfo : ViewPortType;
  12244.  
  12245. procedure DrawBox(X, Y : word);
  12246. begin
  12247.   SetFillStyle(Style, MaxColor);
  12248.   with ViewInfo do
  12249.     Bar(X, Y, X+Width, Y+Height);
  12250.   Rectangle(X, Y, X+Width, Y+Height);
  12251.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  12252.   Inc(Style);
  12253. end; { DrawBox }
  12254.  
  12255. begin
  12256.   MainWindow('Pre-defined fill styles');
  12257.   GetViewSettings(ViewInfo);
  12258.   with ViewInfo do
  12259.   begin
  12260.     Width := 2 * ((x2+1) div 13);
  12261.     Height := 2 * ((y2-10) div 10);
  12262.   end;
  12263.   X := Width div 2;
  12264.   Y := Height div 2;
  12265.   Style := 0;
  12266.   for J := 1 to 3 do
  12267.   begin
  12268.     for I := 1 to 4 do
  12269.     begin
  12270.       DrawBox(X, Y);
  12271.       Inc(X, (Width div 2) * 3);
  12272.     end;
  12273.     X := Width div 2;
  12274.     Inc(Y, (Height div 2) * 3);
  12275.   end;
  12276.   SetTextJustify(LeftText, TopText);
  12277.   WaitToGo;
  12278. end; { FillStylePlay }
  12279.  
  12280. procedure FillPatternPlay;
  12281. { Display some user defined fill patterns }
  12282. const
  12283.   Patterns : array[0..11] of FillPatternType = (
  12284.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  12285.             OldColor which has a path of pixels of OldColor or NewColor
  12286.             with sides touching back to the seed point, (XSeed, YSeed).
  12287.             Therefore, only pixels of OldColor are modified and no other
  12288.             information is changed.
  12289.  
  12290.             SEE ALSO
  12291.  
  12292.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  12293.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  12294.             SETVIEW
  12295.  
  12296.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  12297.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  12298.             IF WHICHVGA = 0 THEN STOP
  12299.             DUMMY=RES640
  12300.             SETVIEW 100, 100, 539, 379
  12301.             FILLVIEW 10
  12302.             WHILE INKEY$ = ""
  12303.             WEND
  12304.             VIDEOMODESET VMODE
  12305.             END
  12306.  
  12307.  
  12308.  
  12309.  
  12310.  
  12311.  
  12312.  
  12313.  
  12314.  
  12315.  
  12316.  
  12317.  
  12318.  
  12319.  
  12320.  
  12321.  
  12322.                                                                          63
  12323.  
  12324.  
  12325.  
  12326.  
  12327.  
  12328.  
  12329.           FONTGETINFO
  12330.  
  12331.             PROTOTYPE
  12332.  
  12333.             SUB FONTGETINFO (Width%, Height%)
  12334.  
  12335.             INPUT
  12336.  
  12337.             no input parameters
  12338.     WEND
  12339.             MOUSEEXIT
  12340.             VIDEOMODESET VMODE
  12341.             END
  12342.  
  12343.  
  12344.  
  12345.  
  12346.  
  12347.  
  12348.  
  12349.  
  12350.  
  12351.  
  12352.  
  12353.  
  12354.  
  12355.  
  12356.  
  12357.  
  12358.  
  12359.  
  12360.  
  12361.  
  12362.  
  12363.  
  12364.  
  12365.  
  12366.  
  12367.  
  12368.  
  12369.  
  12370.  
  12371.  
  12372.  
  12373.  
  12374.  
  12375.  
  12376.  
  12377.  
  12378.  
  12379.  
  12380.  
  12381.  
  12382.                                                                          86
  12383.  
  12384.  
  12385.  
  12386.  
  12387.  
  12388.  
  12389.           MOUSECURSORDEFAULT
  12390.  
  12391.             PROTOTYPE
  12392.  
  12393.             SUB MOUSECURSORDEFAULT ()
  12394.  
  12395.             INPUT
  12396.  
  12397.             no input parameters
  12398.  
  12399.             OUTPUT
  12400.  
  12401.             no value returned
  12402.  
  12403.             USAGE
  12404.  
  12405.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  12406.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  12407. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  12408. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  12409. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  12410. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  12411. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  12412. $╤
  12413. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  12414. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  12415. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  12416. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  12417. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  12418. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  12419. ░£▒
  12420. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  12421. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  12422.       end;
  12423.     end;
  12424.   end;
  12425.   WaitToGo;
  12426. end; { UserLineStylePlay }
  12427.  
  12428.  
  12429. procedure SayGoodbye;
  12430. { Say goodbye and then exit the program }
  12431. var
  12432.   ViewInfo : ViewPortType;
  12433. begin
  12434.   MainWindow('');
  12435.   GetViewSettings(ViewInfo);
  12436.   SetTextStyle(TriplexFont, HorizDir, 4);
  12437.   SetTextJustify(CenterText, CenterText);
  12438.   with ViewInfo do
  12439.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  12440.   StatusLine('Press any key to quit...');
  12441.   repeat until KeyPressed;
  12442. end; { SayGoodbye }
  12443.  
  12444.  
  12445. PROCEDURE SelectMode;
  12446. VAR
  12447.     choice1,choice2     : CHAR;
  12448.    xsize,ysize            : WORD;
  12449. BEGIN
  12450.     (* Let's select a mode *)
  12451.     ClrScr;
  12452.     WriteLn('VESADEMO:');
  12453.     WriteLn('1. 256 colors');
  12454.     WriteLn('2. 32768 colors');
  12455.     WriteLn('3. 65536 colors');
  12456.     WriteLn('4. 16777216 colors');
  12457.     WriteLn('Q uit');
  12458.     WriteLn;
  12459.     Write('Your choice: ');
  12460.     REPEAT
  12461.         ReadLn(choice1);
  12462.       IF choice1 <> '1' THEN BEGIN
  12463.           WriteLn('Sorry !');
  12464.          WriteLn('This demo wasn''t written for more as 256 colors !');
  12465.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  12466.          WriteLn('Switching to 256 colors.');
  12467.          choice1 := '1';
  12468.       END;
  12469.     UNTIL choice1 IN ['1'..'4','q'];
  12470.     IF choice1 = 'q' THEN Halt;
  12471.  
  12472.     WriteLn;
  12473.     WriteLn;
  12474.     WriteLn('a. 320x200');
  12475.     WriteLn('b. 640x480');
  12476.     WriteLn('c. 800x600');
  12477.     WriteLn('d. 1024x768');
  12478.     WriteLn('e. 1280x1024');
  12479.     WriteLn('Q uit');
  12480.     WriteLn;
  12481.     Write('Your choice: ');
  12482.     REPEAT
  12483.         ReadLn(choice2);
  12484.     UNTIL choice2 IN ['a'..'e','q'];
  12485.     IF choice2 = 'q' THEN Halt;
  12486.  
  12487.     CASE choice2 OF
  12488.         'a' : BEGIN
  12489.             xsize := 320;
  12490.             ysize := 200;
  12491.         END;
  12492.         'b' : BEGIN
  12493.             xsize := 640;
  12494.             ysize := 480;
  12495.         END;
  12496.         'c' : BEGIN
  12497.             xsize := 800;
  12498.             ysize := 600;
  12499.         END;
  12500.         'd' : BEGIN
  12501.             xsize := 1024;
  12502.             ysize := 768;
  12503.         END;
  12504.         'e' : BEGIN
  12505.             xsize := 1280;
  12506.             ysize := 1024;
  12507.         END;
  12508.     END;
  12509.     CASE choice1 OF
  12510.         '1' : mode := FindVesaMode(xsize,ysize,8);
  12511.         '2' : mode := FindVesaMode(xsize,ysize,15);
  12512.         '3' : mode := FindVesaMode(xsize,ysize,16);
  12513.         '4' : mode := FindVesaMode(xsize,ysize,24);
  12514.     END;
  12515.     IF mode = 0 THEN BEGIN
  12516.         WriteLn('No such mode could be found !');
  12517.         WriteLn('Switching to to 320x200.');
  12518.         ReadKey;
  12519.         mode := V320x200x256;
  12520.     END;
  12521. END;
  12522.  
  12523. begin { program body }
  12524.   SelectMode;
  12525.   Initialize;
  12526.   ReportStatus;
  12527.  
  12528. {  AspectRatioPlay; }
  12529.   FillEllipsePlay;
  12530.   SectorPlay;
  12531.   WriteModePlay;
  12532.  
  12533.   ColorPlay;
  12534.   { PalettePlay only intended to work on these drivers: }
  12535.   if (GraphDriver = EGA) or
  12536.       (GraphDriver = EGA64) or
  12537.       (GraphDriver = VGA) then
  12538.      PalettePlay;
  12539.   PutPixelPlay;
  12540. {  PutImagePlay; }
  12541.   RandBarPlay;
  12542.   BarPlay;
  12543.   Bar3DPlay;
  12544.   ArcPlay;
  12545.   CirclePlay;
  12546.   PiePlay;
  12547.   LineToPlay;
  12548.   LineRelPlay;
  12549. {  LineStylePlay; }
  12550. {  UserLineStylePlay; }
  12551.   TextDump;
  12552.   TextPlay;
  12553.   CrtModePlay;
  12554.   FillStylePlay;
  12555.   FillPatternPlay;
  12556.   PolyPlay;
  12557.   SayGoodbye;
  12558. {  CloseGraph; }
  12559.   CloseVesa;
  12560. end.
  12561. ***************************************************
  12562.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  12563.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  12564. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  12565. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  12566. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  12567. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  12568.     Color := RandColor;
  12569.     SetColor(Color);
  12570.     SetFillStyle(Random(CloseDotFill)+1, Color);
  12571.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  12572.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  12573.   until KeyPressed;
  12574.   WaitToGo;
  12575. end; { RandBarPlay }
  12576.  
  12577. procedure ArcPlay;
  12578. { Draw random arcs on the screen }
  12579. var
  12580.   MaxRadius : word;
  12581.   EndAngle : word;
  12582.   ArcInfo : ArcCoordsType;
  12583. begin
  12584.   MainWindow('Arc / GetArcCoords demonstration');
  12585.   StatusLine('Esc aborts or press a key');
  12586.   MaxRadius := MaxY div 10;
  12587.   repeat
  12588.     SetColor(RandColor);
  12589.     EndAngle := Random(360);
  12590.     SetLineStyle(SolidLn, 0, NormWidth);
  12591.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  12592.     GetArcCoords(ArcInfo);
  12593.     with ArcInfo do
  12594.     begin
  12595.       Line(X, Y, XStart, YStart);
  12596.       Line(X, Y, Xend, Yend);
  12597.     end;
  12598.   until KeyPressed;
  12599.   WaitToGo;
  12600. end; { ArcPlay }
  12601.  
  12602. procedure PutPixelPlay;
  12603. { Demonstrate the PutPixel and GetPixel commands }
  12604. const
  12605.   Seed   = 1962; { A seed for the random number generator }
  12606.   NumPts = 2000; { The number of pixels plotted }
  12607.   Esc    = #27;
  12608. var
  12609.   I : word;
  12610.   X, Y, Color : word;
  12611.   XMax, YMax  : integer;
  12612.   ViewInfo    : ViewPortType;
  12613. begin
  12614.   MainWindow('PutPixel / GetPixel demonstration');
  12615.   StatusLine('Esc aborts or press a key...');
  12616.  
  12617.   GetViewSettings(ViewInfo);
  12618.   with ViewInfo do
  12619.   begin
  12620.     XMax := (x2-x1-1);
  12621.     YMax := (y2-y1-1);
  12622.   end;
  12623.  
  12624.   while not KeyPressed do
  12625.   begin
  12626.     { Plot random pixels }
  12627.     RandSeed := Seed;
  12628.     I := 0;
  12629.     while (not KeyPressed) and (I < NumPts) do
  12630.     begin
  12631.       Inc(I);
  12632.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  12633.     end;
  12634.  
  12635.     { Erase pixels }
  12636.     RandSeed := Seed;
  12637.     I := 0;
  12638.     while (not KeyPressed) and (I < NumPts) do
  12639.     begin
  12640.       Inc(I);
  12641.       X := Random(XMax)+1;
  12642.       Y := Random(YMax)+1;
  12643.       Color := GetPixel(X, Y);
  12644.         if Color = RandColor then
  12645.           PutPixel(X, Y, 0);
  12646.      end;
  12647.   end;
  12648.   WaitToGo;
  12649. end; { PutPixelPlay }
  12650.  
  12651. procedure PutImagePlay;
  12652. { Demonstrate the GetImage and PutImage commands }
  12653.  
  12654. const
  12655.   r  = 20;
  12656.   StartX = 100;
  12657.   StartY = 50;
  12658.  
  12659. var
  12660.   CurPort : ViewPortType;
  12661.  
  12662. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  12663. var
  12664.   Step : integer;
  12665. begin
  12666.   Step := Random(2*r);
  12667.   if Odd(Step) then
  12668.     Step := -Step;
  12669.   X := X + Step;
  12670.   Step := Random(r);
  12671.   if Odd(Step) then
  12672.     Step := -Step;
  12673.   Y := Y + Step;
  12674.  
  12675.   { Make saucer bounce off viewport walls }
  12676.   with CurPort do
  12677.   begin
  12678.     if (x1 + X + Width - 1 > x2) then
  12679.       X := x2-x1 - Width + 1
  12680.     else
  12681.       if (X < 0) then
  12682.         X := 0;
  12683.     if (y1 + Y + Height - 1 > y2) then
  12684.       Y := y2-y1 - Height + 1
  12685.     else
  12686.       if (Y < 0) then
  12687.         Y := 0;
  12688.   end;
  12689. end; { MoveSaucer }
  12690.  
  12691. var
  12692.   Pausetime : word;
  12693.   Saucer    : pointer;
  12694.   X, Y      : integer;
  12695.   ulx, uly  : word;
  12696.   lrx, lry  : word;
  12697.   Size      : word;
  12698.   I         : word;
  12699. begin
  12700.   ClearDevice;
  12701.   FullPort;
  12702.  
  12703.   { PaintScreen }
  12704.   ClearDevice;
  12705.   MainWindow('GetImage / PutImage Demonstration');
  12706.   StatusLine('Esc aborts or press a key...');
  12707.   GetViewSettings(CurPort);
  12708.  
  12709.   { DrawSaucer }
  12710.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  12711.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  12712.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  12713.   Circle(StartX+10, StartY-12, 2);
  12714.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  12715.   Circle(StartX-10, StartY-12, 2);
  12716.   SetFillStyle(SolidFill, MaxColor);
  12717.   FloodFill(StartX+1, StartY+4, GetColor);
  12718.  
  12719.   { ReadSaucerImage }
  12720.   ulx := StartX-(r+1);
  12721.   uly := StartY-14;
  12722.   lrx := StartX+(r+1);
  12723.   lry := StartY+(r div 3)+3;
  12724.  
  12725.   Size := ImageSize(ulx, uly, lrx, lry);
  12726.   GetMem(Saucer, Size);
  12727.   GetImage(ulx, uly, lrx, lry, Saucer^);
  12728. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  12729.  
  12730.   { Plot some "stars" }
  12731.   for I := 1 to 1000 do
  12732.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  12733.   X := MaxX div 2;
  12734.   Y := MaxY div 2;
  12735.   PauseTime := 70;
  12736.  
  12737.   { Move the saucer around }
  12738.   repeat
  12739. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  12740.      Delay(PauseTime);
  12741. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  12742.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  12743.   until KeyPressed;
  12744.   FreeMem(Saucer, size);
  12745.   WaitToGo;
  12746. end; { PutImagePlay }
  12747.  
  12748. procedure PolyPlay;
  12749. { Draw random polygons with random fill styles on the screen }
  12750. const
  12751.   MaxPts = 5;
  12752. type
  12753.   PolygonType = array[1..MaxPts] of PointType;
  12754. var
  12755.   Poly : PolygonType;
  12756.   I, Color : word;
  12757. begin
  12758.   MainWindow('FillPoly demonstration